Merge pull request #322 from ZhengPeiRu21/fixDeckStatsTest
Fix getDeckStats test
This commit is contained in:
commit
1d5b87b3f4
@ -345,12 +345,15 @@ class AnkiConnect:
|
||||
raise NotFoundError('Note was not found: {}'.format(note_id))
|
||||
|
||||
def deckStatsToJson(self, due_tree):
|
||||
return {'deck_id': due_tree.deck_id,
|
||||
'name': due_tree.name,
|
||||
'new_count': due_tree.new_count,
|
||||
'learn_count': due_tree.learn_count,
|
||||
'review_count': due_tree.review_count,
|
||||
'total_in_deck': due_tree.total_in_deck}
|
||||
deckStats = {'deck_id': due_tree.deck_id,
|
||||
'name': due_tree.name,
|
||||
'new_count': due_tree.new_count,
|
||||
'learn_count': due_tree.learn_count,
|
||||
'review_count': due_tree.review_count}
|
||||
if anki_version > (2, 1, 46):
|
||||
# total_in_deck is not supported on lower Anki versions
|
||||
deckStats['total_in_deck'] = due_tree.total_in_deck
|
||||
return deckStats
|
||||
|
||||
def collectDeckTreeChildren(self, parent_node):
|
||||
allNodes = {parent_node.deck_id: parent_node}
|
||||
|
@ -71,4 +71,4 @@ def test_removedDeckConfigId_fails_with_invalid_id(session_with_profile_loaded):
|
||||
|
||||
def test_getDeckStats(session_with_profile_loaded):
|
||||
result = ac.getDeckStats(decks=["Default"])
|
||||
assert result["name"] == "Default"
|
||||
assert list(result.values())[0]["name"] == "Default"
|
||||
|
Loading…
Reference in New Issue
Block a user