MCPcopy Create free account
hub / github.com/apecloud/myduckserver / run

Method run

compatibility/pg/python/pg_test.py:9–34  ·  view source on GitHub ↗
(self, cursor)

Source from the content-addressed store, hash-verified

7 self.expected_results = expected_results
8
9 def run(self, cursor):
10 print(f"Running test: {self.query}")
11 cursor.execute(self.query)
12 if cursor.description is None:
13 if len(self.expected_results) != 0:
14 print(f"Expected {len(self.expected_results)} rows, got 0")
15 return False
16 print("Returns 0 rows")
17 return True
18
19 rows = cursor.fetchall()
20 if len(rows[0]) != len(self.expected_results[0]):
21 print(f"Expected {len(self.expected_results[0])} columns, got {len(rows[0])}")
22 return False
23
24 for row, expected_row in zip(rows, self.expected_results):
25 if list(map(str, row)) != list(map(str, expected_row)):
26 print(f"Expected: {list(map(str, expected_row))}, got: {list(map(str, row))}")
27 return False
28
29 print(f"Returns {len(rows)} rows")
30 if len(rows) != len(self.expected_results):
31 print(f"Expected {len(self.expected_results)} rows")
32 return False
33
34 return True
35
36 def __init__(self):
37 self.conn = None

Callers 1

run_testsMethod · 0.45

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected