From d330d2f77f71dffa4c480bc611f77de41ca947d7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 15 Aug 2017 21:31:58 +1000 Subject: [PATCH] fix unit tests --- tests/test_collection.py | 6 +++--- tests/test_sync.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_collection.py b/tests/test_collection.py index 2b6415dec..1d221d199 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -2,7 +2,7 @@ import os, tempfile from tests.shared import assertException, getEmptyCol -from anki.stdmodels import addBasicModel +from anki.stdmodels import addBasicModel, models from anki import Collection as aopen @@ -113,10 +113,10 @@ def test_addDelTags(): def test_timestamps(): deck = getEmptyCol() - assert len(deck.models.models) == 4 + assert len(deck.models.models) == len(models) for i in range(100): addBasicModel(deck) - assert len(deck.models.models) == 104 + assert len(deck.models.models) == 100 + len(models) def test_furigana(): deck = getEmptyCol() diff --git a/tests/test_sync.py b/tests/test_sync.py index 5fdfa52e2..585e68ca9 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -7,6 +7,7 @@ from anki.utils import intTime from anki.sync import Syncer, LocalServer from anki.consts import STARTING_FACTOR from tests.shared import getEmptyCol, getEmptyDeckWith +import anki.stdmodels # Local tests ########################################################################## @@ -63,7 +64,7 @@ def test_sync(): for d in deck1, deck2: for t in ("revlog", "notes", "cards"): assert d.db.scalar("select count() from %s" % t) == num - assert len(d.models.all()) == num*4 + assert len(d.models.all()) == num*len(anki.stdmodels.models) # the default deck and config have an id of 1, so always 1 assert len(d.decks.all()) == 1 assert len(d.decks.dconf) == 1