mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
add unit test for order
This commit is contained in:
parent
1641256da4
commit
974324e3dd
2 changed files with 24 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
from anki.db import DB
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
from tests.shared import getEmptyDeck
|
from tests.shared import getEmptyDeck
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,29 @@ def test_new():
|
||||||
assert(stripHTML(c.q()) == qs[n])
|
assert(stripHTML(c.q()) == qs[n])
|
||||||
d.sched.answerCard(c, 2)
|
d.sched.answerCard(c, 2)
|
||||||
|
|
||||||
|
def test_newOrder():
|
||||||
|
d = getEmptyDeck()
|
||||||
|
m = d.currentModel()
|
||||||
|
for i in range(50):
|
||||||
|
t = m.newTemplate()
|
||||||
|
t['name'] = str(i)
|
||||||
|
t['qfmt'] = "{{Front}}"
|
||||||
|
t['afmt'] = "{{Back}}"
|
||||||
|
t['actv'] = i > 25
|
||||||
|
m.addTemplate(t)
|
||||||
|
m.flush()
|
||||||
|
f = d.newFact()
|
||||||
|
f['Front'] = u'1'
|
||||||
|
f['Back'] = u'2'
|
||||||
|
# add first half
|
||||||
|
d.addFact(f)
|
||||||
|
# generate second half
|
||||||
|
d.db.execute("update cards set gid = random()")
|
||||||
|
d.qconf['newPerDay'] = 100
|
||||||
|
d.reset()
|
||||||
|
# cards should be sorted by id
|
||||||
|
assert d.sched.newQueue == list(reversed(sorted(d.sched.newQueue)))
|
||||||
|
|
||||||
def test_learn():
|
def test_learn():
|
||||||
d = getEmptyDeck()
|
d = getEmptyDeck()
|
||||||
# add a fact
|
# add a fact
|
||||||
|
|
Loading…
Reference in a new issue