diff options
Diffstat (limited to 'tests/state_json_unittest.py')
-rw-r--r-- | tests/state_json_unittest.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/state_json_unittest.py b/tests/state_json_unittest.py new file mode 100644 index 0000000..03ea555 --- /dev/null +++ b/tests/state_json_unittest.py @@ -0,0 +1,14 @@ +import pytest + +from flashcards import state_json + +def test_saveAndLoad(tmp_path): + file = tmp_path / "test.json" + state = {"key": [10, 20, None], "another_key": "value"} + + state_json.save(file, state) + + assert state_json.load(file) == state + +def test_missingFile(tmp_path): + assert state_json.load(tmp_path / "missing.json") == {} |