From 68445d724321fce38f3cedef72786bcd0eadcfba Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 24 Dec 2017 10:50:17 +1000 Subject: [PATCH] add test for new position preservation --- tests/test_sched.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_sched.py b/tests/test_sched.py index 978e14d42..51245fb2c 100644 --- a/tests/test_sched.py +++ b/tests/test_sched.py @@ -1067,3 +1067,30 @@ def test_failmult(): # so the card is reset to new d.sched.answerCard(c, 1) assert c.ivl == 1 + +# answering a new card with scheduling off should not change +# the original position +def test_preview_order(): + d = getEmptyCol() + f = d.newNote() + f['Front'] = "oneone" + d.addNote(f) + f = d.newNote() + f['Front'] = "twotwo" + d.addNote(f) + assert d.getCard(d.findCards("oneone")[0]).due == 1 + assert d.getCard(d.findCards("twotwo")[0]).due == 2 + + did = d.decks.newDyn("Cram") + cram = d.decks.get(did) + cram['resched'] = False + d.sched.rebuildDyn(did) + d.reset() + + c = d.sched.getCard() + assert "oneone" in c.q() + d.sched.answerCard(c, 3) + d.sched.answerCard(c, 3) + + assert c.due == 1 +