mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
fix unit tests
This commit is contained in:
parent
d0389e138e
commit
d330d2f77f
2 changed files with 5 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import os, tempfile
|
import os, tempfile
|
||||||
from tests.shared import assertException, getEmptyCol
|
from tests.shared import assertException, getEmptyCol
|
||||||
from anki.stdmodels import addBasicModel
|
from anki.stdmodels import addBasicModel, models
|
||||||
|
|
||||||
from anki import Collection as aopen
|
from anki import Collection as aopen
|
||||||
|
|
||||||
|
@ -113,10 +113,10 @@ def test_addDelTags():
|
||||||
|
|
||||||
def test_timestamps():
|
def test_timestamps():
|
||||||
deck = getEmptyCol()
|
deck = getEmptyCol()
|
||||||
assert len(deck.models.models) == 4
|
assert len(deck.models.models) == len(models)
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
addBasicModel(deck)
|
addBasicModel(deck)
|
||||||
assert len(deck.models.models) == 104
|
assert len(deck.models.models) == 100 + len(models)
|
||||||
|
|
||||||
def test_furigana():
|
def test_furigana():
|
||||||
deck = getEmptyCol()
|
deck = getEmptyCol()
|
||||||
|
|
|
@ -7,6 +7,7 @@ from anki.utils import intTime
|
||||||
from anki.sync import Syncer, LocalServer
|
from anki.sync import Syncer, LocalServer
|
||||||
from anki.consts import STARTING_FACTOR
|
from anki.consts import STARTING_FACTOR
|
||||||
from tests.shared import getEmptyCol, getEmptyDeckWith
|
from tests.shared import getEmptyCol, getEmptyDeckWith
|
||||||
|
import anki.stdmodels
|
||||||
|
|
||||||
# Local tests
|
# Local tests
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -63,7 +64,7 @@ def test_sync():
|
||||||
for d in deck1, deck2:
|
for d in deck1, deck2:
|
||||||
for t in ("revlog", "notes", "cards"):
|
for t in ("revlog", "notes", "cards"):
|
||||||
assert d.db.scalar("select count() from %s" % t) == num
|
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
|
# the default deck and config have an id of 1, so always 1
|
||||||
assert len(d.decks.all()) == 1
|
assert len(d.decks.all()) == 1
|
||||||
assert len(d.decks.dconf) == 1
|
assert len(d.decks.dconf) == 1
|
||||||
|
|
Loading…
Reference in a new issue