Uses constant in tests

This commit is contained in:
Arthur Milchior 2020-07-19 05:27:31 +02:00
parent f04ea6904d
commit 23eeb84556
4 changed files with 11 additions and 10 deletions

View File

@ -83,7 +83,7 @@ def test_findCards():
c.flush()
assert col.findCards("is:due") == [c.id]
assert len(col.findCards("-is:due")) == 4
c.queue = -1
c.queue = QUEUE_TYPE_SUSPENDED
# ensure this card gets a later mod time
c.flush()
col.db.execute("update cards set mod = mod + 1 where id = ?", c.id)

View File

@ -5,6 +5,7 @@ from tempfile import NamedTemporaryFile
import pytest
from anki.consts import *
from anki.importing import (
Anki2Importer,
AnkiPackageImporter,
@ -328,5 +329,5 @@ def test_mnemo():
i.run()
assert col.cardCount() == 7
assert "a_longer_tag" in col.tags.all()
assert col.db.scalar("select count() from cards where type = 0") == 1
assert col.db.scalar(f"select count() from cards where type = {CARD_TYPE_NEW}") == 1
col.close()

View File

@ -179,8 +179,8 @@ def test_learn():
assert c.due == col.sched.today + 1
assert c.ivl == 1
# or normal removal
c.type = 0
c.queue = 1
c.type = CARD_TYPE_NEW
c.queue = QUEUE_TYPE_LRN
col.sched.answerCard(c, 3)
assert c.type == CARD_TYPE_REV
assert c.queue == QUEUE_TYPE_REV
@ -189,7 +189,7 @@ def test_learn():
assert col.db.scalar("select count() from revlog where type = 0") == 5
# now failed card handling
c.type = CARD_TYPE_REV
c.queue = 1
c.queue = QUEUE_TYPE_LRN
c.odue = 123
col.sched.answerCard(c, 3)
assert c.due == 123
@ -197,7 +197,7 @@ def test_learn():
assert c.queue == QUEUE_TYPE_REV
# we should be able to remove manually, too
c.type = CARD_TYPE_REV
c.queue = 1
c.queue = QUEUE_TYPE_LRN
c.odue = 321
c.flush()
col.sched.removeLrn()
@ -410,7 +410,7 @@ def test_overdue_lapse():
# simulate a review that was lapsed and is now due for its normal review
c = note.cards()[0]
c.type = CARD_TYPE_REV
c.queue = 1
c.queue = QUEUE_TYPE_LRN
c.due = -1
c.odue = -1
c.factor = STARTING_FACTOR

View File

@ -182,8 +182,8 @@ def test_learn():
assert c.due == col.sched.today + 1
assert c.ivl == 1
# or normal removal
c.type = 0
c.queue = 1
c.type = CARD_TYPE_NEW
c.queue = QUEUE_TYPE_LRN
col.sched.answerCard(c, 4)
assert c.type == CARD_TYPE_REV
assert c.queue == QUEUE_TYPE_REV
@ -502,7 +502,7 @@ def test_overdue_lapse():
# simulate a review that was lapsed and is now due for its normal review
c = note.cards()[0]
c.type = CARD_TYPE_REV
c.queue = 1
c.queue = QUEUE_TYPE_LRN
c.due = -1
c.odue = -1
c.factor = STARTING_FACTOR