mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
update unit test for leech change
This commit is contained in:
parent
1aaf1059b4
commit
1cb0ac3670
2 changed files with 3 additions and 18 deletions
|
@ -3,7 +3,6 @@
|
||||||
import copy
|
import copy
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from anki import hooks
|
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
from anki.lang import without_unicode_isolation
|
from anki.lang import without_unicode_isolation
|
||||||
from anki.utils import intTime
|
from anki.utils import intTime
|
||||||
|
@ -376,23 +375,6 @@ def test_reviews():
|
||||||
assert c.due == d.sched.today + c.ivl
|
assert c.due == d.sched.today + c.ivl
|
||||||
# factor should have been increased
|
# factor should have been increased
|
||||||
assert c.factor == 2650
|
assert c.factor == 2650
|
||||||
# leech handling
|
|
||||||
##################################################
|
|
||||||
c = copy.copy(cardcopy)
|
|
||||||
c.lapses = 7
|
|
||||||
c.flush()
|
|
||||||
# steup hook
|
|
||||||
hooked = []
|
|
||||||
|
|
||||||
def onLeech(card):
|
|
||||||
hooked.append(1)
|
|
||||||
|
|
||||||
hooks.card_did_leech.append(onLeech)
|
|
||||||
d.sched.answerCard(c, 1)
|
|
||||||
assert hooked
|
|
||||||
assert c.queue == QUEUE_TYPE_SUSPENDED
|
|
||||||
c.load()
|
|
||||||
assert c.queue == QUEUE_TYPE_SUSPENDED
|
|
||||||
|
|
||||||
|
|
||||||
def test_button_spacing():
|
def test_button_spacing():
|
||||||
|
|
|
@ -389,6 +389,9 @@ def test_reviews():
|
||||||
assert c.factor == 2650
|
assert c.factor == 2650
|
||||||
# leech handling
|
# leech handling
|
||||||
##################################################
|
##################################################
|
||||||
|
conf = d.decks.getConf(1)
|
||||||
|
conf["lapse"]["leechAction"] = LEECH_SUSPEND
|
||||||
|
d.decks.save(conf)
|
||||||
c = copy.copy(cardcopy)
|
c = copy.copy(cardcopy)
|
||||||
c.lapses = 7
|
c.lapses = 7
|
||||||
c.flush()
|
c.flush()
|
||||||
|
|
Loading…
Reference in a new issue