Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions movies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,18 @@ def test8():
@check50.check(exists)
def test9():
"""9.sql produces correct result"""
check_single_col(
check_double_col(
run_query("9.sql"),
[
"Craig T. Nelson",
"Richard Griffifths",
"Samuel L. Jackson",
"Holly Hunter",
"Jason Lee",
"Rupert Grint",
"Daniel Radcliffe",
"Emma Watson",
{"Craig T. Nelson", "33"},
{"Richard Griffifths", "34"},
{"Samuel L. Jackson", "30"},
{"Holly Hunter", "31"},
{"Jason Lee", "32"},
{"Rupert Grint", "35"},
{"Daniel Radcliffe", "36"},
{"Emma Watson", "38"},
{"Emma Watson", "11"},
],
ordered=True,
)
Expand Down Expand Up @@ -221,7 +222,6 @@ def check_single_col(actual, expected, ordered=False):
# Get data from column
try:
result = [str(list(row.values())[0]) for row in actual]
result = result if ordered else set(result)
except IndexError:
return None

Expand All @@ -230,7 +230,8 @@ def check_single_col(actual, expected, ordered=False):

# If unordered, sort both before checking
if not ordered:
expected = set(expected)
result.sort()
expected.sort()

if result != expected:
raise check50.Mismatch("\n".join(expected), "\n".join(list(result)))
Expand Down
Binary file modified movies/movies.db
Binary file not shown.