MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / test_get_difficult_cards

Function test_get_difficult_cards

backend/tests/stats/test_services.py:90–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90def test_get_difficult_cards():
91 mock_session = MagicMock(spec=Session)
92 mock_collection_id = uuid.uuid4()
93
94 mock_difficult_cards = [
95 (uuid.uuid4(), "Difficult Card 1", 7, 2),
96 (uuid.uuid4(), "Difficult Card 2", 6, 2),
97 (uuid.uuid4(), "Difficult Card 3", 5, 1),
98 ]
99
100 mock_exec = mock_session.exec.return_value
101 mock_exec.all.return_value = mock_difficult_cards
102
103 result = _get_difficult_cards(
104 session=mock_session, collection_id=mock_collection_id
105 )
106
107 assert isinstance(result, list)
108 assert len(result) == len(mock_difficult_cards)
109
110 for i, card_stat in enumerate(result):
111 assert card_stat.id == mock_difficult_cards[i][0]
112 assert card_stat.front == mock_difficult_cards[i][1]
113 assert card_stat.total_attempts == mock_difficult_cards[i][2]
114 assert card_stat.correct_answers == mock_difficult_cards[i][3]
115
116
117def test_get_collection_stats():

Callers

nothing calls this directly

Calls 1

_get_difficult_cardsFunction · 0.90

Tested by

no test coverage detected