test_helpers: Convert TypedDict from queries_captured to dataclass.

An implicit coercion from an untyped dict to the TypedDict was hiding
a type error: CapturedQuery.sql was really str, not bytes.  We should
always prefer dataclass over TypedDict to prevent such errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 92db6eba78)
This commit is contained in:
Anders Kaseorg
2023-06-06 14:54:19 -07:00
committed by Alex Vandiver
parent 9628cc9278
commit 201cab601a
4 changed files with 25 additions and 24 deletions

View File

@@ -1189,7 +1189,7 @@ Output:
if actual_count != count: # nocoverage
print("\nITEMS:\n")
for index, query in enumerate(queries):
print(f"#{index + 1}\nsql: {str(query['sql'])}\ntime: {query['time']}\n")
print(f"#{index + 1}\nsql: {str(query.sql)}\ntime: {query.time}\n")
print(f"expected count: {count}\nactual count: {actual_count}")
raise AssertionError(
f"""