summaryrefslogtreecommitdiffstats
path: root/src/parser_unittest.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-09-23 12:27:10 +0200
committerEddy Pedroni <epedroni@pm.me>2024-09-23 12:27:10 +0200
commit513e102fc92aabfeffc441c75c4f87c31cdc4cc6 (patch)
tree4b8e0cfe024c895c29c0f7801c5499a6921b45c0 /src/parser_unittest.py
parent2c8b068fe2e5241a4c96d2284eddebeb4b526c05 (diff)
Parser returns dict instead of list
Diffstat (limited to 'src/parser_unittest.py')
-rw-r--r--src/parser_unittest.py13
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"