diff options
Diffstat (limited to 'src/parser_unittest.py')
-rw-r--r-- | src/parser_unittest.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/parser_unittest.py b/src/parser_unittest.py index 02638e6..9ada265 100644 --- a/src/parser_unittest.py +++ b/src/parser_unittest.py @@ -32,10 +32,10 @@ Another back """ - expected = [ + expected = { ("Foo\n\nBar", "Fizz\n\nBuzz"), ("Another card", "Another back") - ] + } path = tmp_path / "valid_file.fcard" with open(path, "w") as f: @@ -43,10 +43,7 @@ Another back cards = parser.parse(path) - assert expected == [(c.front, c.back) for c in cards] - - # Cards have unique IDs - assert len(set([c.id for c in cards])) == len(cards) + assert expected == set(cards.values()) # Edge cases def test_emptyFile(tmp_path): @@ -55,11 +52,11 @@ def test_emptyFile(tmp_path): f.write("") cards = parser.parse(path) - assert cards == [] + assert cards == {} def test_missingFile(tmp_path): cards = parser.parse(tmp_path / "missing_file.fcard") - assert cards == [] + assert cards == {} def checkException(tmp_path, file_contents): path = tmp_path / "invalid_file.fcard" |