diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-09-25 19:10:24 +0200 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-09-25 19:10:24 +0200 |
commit | 7f6ab3e4c535eb0cc8b8dfdaa591e1cd7131e537 (patch) | |
tree | c8343dc13296b760ea94144115b758df28d4d328 /src/state_json_unittest.py | |
parent | ebc193873c382bd814730e8ea3032604ebb4a851 (diff) |
Extract state save/load to helper module
Diffstat (limited to 'src/state_json_unittest.py')
-rw-r--r-- | src/state_json_unittest.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/state_json_unittest.py b/src/state_json_unittest.py new file mode 100644 index 0000000..e784f58 --- /dev/null +++ b/src/state_json_unittest.py @@ -0,0 +1,13 @@ +import pytest +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") == {} |