diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-09-26 10:02:15 +0200 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-09-26 10:02:15 +0200 |
commit | e65bef9c22244fc9bcd22a37d335f5f76ba16ff5 (patch) | |
tree | 9af6fa41bfee6fc03c3ab30cf1b23a82bdf8f2e7 /src/session_integrationtest.py | |
parent | ce76b00d7b2ccac6843732f92becfabb753864a0 (diff) |
Create separate packages for library and CLI
Diffstat (limited to 'src/session_integrationtest.py')
-rw-r--r-- | src/session_integrationtest.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/session_integrationtest.py b/src/session_integrationtest.py deleted file mode 100644 index 2c5d608..0000000 --- a/src/session_integrationtest.py +++ /dev/null @@ -1,46 +0,0 @@ -import pytest -import json -from session import Session - -@pytest.fixture -def cardFiles(tmp_path): - card_files = [ - tmp_path / "test1.fcard", - tmp_path / "test2.fcard", - ] - - for i, c in enumerate(card_files): - with open(c, "w") as f: - for j in range(0, 3): - f.write(f"FRONT\nFile {i}, card {j} front\nBACK\nback\n") - - return card_files - -@pytest.fixture -def stateFile(tmp_path): - return tmp_path / "state.json" - -def test_practiceSession(cardFiles, stateFile): - session = Session("brutal", cardFiles, stateFile) - - c = 0 - for card in session.practice(5): - c += 1 - - assert c == 5 - -def test_testSession(cardFiles, stateFile): - session = Session("brutal", cardFiles, stateFile) - - c = 0 - for i, (card, correct) in enumerate(session.test(5)): - c += 1 - correct(i % 2 == 0) - - assert c == 5 - - with open(stateFile, "r") as f: - state = json.load(f) - latest_scores = [history[-1] for id, history in state.items()] - assert latest_scores.count(0) == 2 - assert latest_scores.count(1) == 3 |