diff --git a/tests/shared.py b/tests/shared.py index a8ba830bc..b081b0cbe 100644 --- a/tests/shared.py +++ b/tests/shared.py @@ -12,19 +12,19 @@ def assertException(exception, func): # Creating new decks is expensive. Just do it once, and then spin off # copies from the master. -def getEmptyDeck(): - if len(getEmptyDeck.master) == 0: +def getEmptyCol(): + if len(getEmptyCol.master) == 0: (fd, nam) = tempfile.mkstemp(suffix=".anki2") os.close(fd) os.unlink(nam) col = aopen(nam) col.db.close() - getEmptyDeck.master = nam + getEmptyCol.master = nam (fd, nam) = tempfile.mkstemp(suffix=".anki2") - shutil.copy(getEmptyDeck.master, nam) + shutil.copy(getEmptyCol.master, nam) return aopen(nam) -getEmptyDeck.master = "" +getEmptyCol.master = "" # Fallback for when the DB needs options passed in. def getEmptyDeckWith(**kwargs): diff --git a/tests/test_cards.py b/tests/test_cards.py index 23d56d641..16a47982a 100644 --- a/tests/test_cards.py +++ b/tests/test_cards.py @@ -1,9 +1,9 @@ # coding: utf-8 -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol def test_previewCards(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'1' f['Back'] = u'2' @@ -23,7 +23,7 @@ def test_previewCards(): assert deck.cardCount() == 1 def test_delete(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'1' f['Back'] = u'2' @@ -39,7 +39,7 @@ def test_delete(): assert deck.db.scalar("select count() from graves") == 2 def test_misc(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u'1' f['Back'] = u'2' @@ -49,7 +49,7 @@ def test_misc(): assert c.template()['ord'] == 0 def test_genrem(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u'1' f['Back'] = u'' @@ -76,7 +76,7 @@ def test_genrem(): assert len(f.cards()) == 2 def test_gendeck(): - d = getEmptyDeck() + d = getEmptyCol() cloze = d.models.byName("Cloze") d.models.setCurrent(cloze) f = d.newNote() diff --git a/tests/test_collection.py b/tests/test_collection.py index 8e1e99a88..b1db640ef 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -1,7 +1,7 @@ # coding: utf-8 import os, tempfile -from tests.shared import assertException, getEmptyDeck +from tests.shared import assertException, getEmptyCol from anki.stdmodels import addBasicModel from anki import Collection as aopen @@ -41,7 +41,7 @@ def test_openReadOnly(): os.unlink(newPath) def test_noteAddDelete(): - deck = getEmptyDeck() + deck = getEmptyCol() # add a note f = deck.newNote() f['Front'] = u"one"; f['Back'] = u"two" @@ -80,7 +80,7 @@ def test_noteAddDelete(): assert f2.dupeOrEmpty() def test_fieldChecksum(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u"new"; f['Back'] = u"new2" deck.addNote(f) @@ -93,7 +93,7 @@ def test_fieldChecksum(): "select csum from notes") == int("302811ae", 16) def test_addDelTags(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u"1" deck.addNote(f) @@ -112,14 +112,14 @@ def test_addDelTags(): assert len(f.tags) == 2 def test_timestamps(): - deck = getEmptyDeck() + deck = getEmptyCol() assert len(deck.models.models) == 4 for i in range(100): addBasicModel(deck) assert len(deck.models.models) == 104 def test_furigana(): - deck = getEmptyDeck() + deck = getEmptyCol() mm = deck.models m = mm.current() # filter should work diff --git a/tests/test_decks.py b/tests/test_decks.py index 6f4d91dc6..efe027e2f 100644 --- a/tests/test_decks.py +++ b/tests/test_decks.py @@ -1,9 +1,9 @@ # coding: utf-8 -from tests.shared import assertException, getEmptyDeck +from tests.shared import assertException, getEmptyCol def test_basic(): - deck = getEmptyDeck() + deck = getEmptyCol() # we start with a standard deck assert len(deck.decks.decks) == 1 # it should have an id of 1 @@ -42,7 +42,7 @@ def test_basic(): deck.sched.deckDueList() def test_remove(): - deck = getEmptyDeck() + deck = getEmptyCol() # create a new deck, and add a note/card to it g1 = deck.decks.id("g1") f = deck.newNote() @@ -68,7 +68,7 @@ def test_remove(): assert deck.noteCount() == 0 def test_rename(): - d = getEmptyDeck() + d = getEmptyCol() id = d.decks.id("hello::world") # should be able to rename into a completely different branch, creating # parents as necessary @@ -89,7 +89,7 @@ def test_rename(): assert n in d.decks.allNames() def test_renameForDragAndDrop(): - d = getEmptyDeck() + d = getEmptyCol() def deckNames(): return [ name for name in sorted(d.decks.allNames()) if name <> u'Default' ] diff --git a/tests/test_exporting.py b/tests/test_exporting.py index 428a621a4..63d950513 100644 --- a/tests/test_exporting.py +++ b/tests/test_exporting.py @@ -4,7 +4,7 @@ import nose, os, tempfile from anki import Collection as aopen from anki.exporting import * from anki.importing import Anki2Importer -from shared import getEmptyDeck +from shared import getEmptyCol deck = None ds = None @@ -12,7 +12,7 @@ testDir = os.path.dirname(__file__) def setup1(): global deck - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u"foo"; f['Back'] = u"bar"; f.tags = ["tag", "tag2"] deck.addNote(f) @@ -81,7 +81,7 @@ def test_export_ankipkg(): @nose.with_setup(setup1) def test_export_anki_due(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u"foo" deck.addNote(f) @@ -104,7 +104,7 @@ def test_export_anki_due(): os.unlink(newname) e.exportInto(newname) # importing into a new deck, the due date should be equivalent - deck2 = getEmptyDeck() + deck2 = getEmptyCol() imp = Anki2Importer(deck2, newname) imp.run() c = deck2.getCard(c.id) diff --git a/tests/test_find.py b/tests/test_find.py index 4d2fbc79f..42058f3f1 100644 --- a/tests/test_find.py +++ b/tests/test_find.py @@ -1,7 +1,7 @@ # coding: utf-8 from anki.find import Finder -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol def test_parse(): f = Finder(None) @@ -20,7 +20,7 @@ def test_parse(): assert f._tokenize("deck:'two words'") == ["deck:two words"] def test_findCards(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'dog' f['Back'] = u'cat' @@ -216,7 +216,7 @@ def test_findCards(): assert len(deck.findCards("added:2")) == deck.cardCount() def test_findReplace(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'foo' f['Back'] = u'bar' @@ -243,7 +243,7 @@ def test_findReplace(): f.load(); assert f['Back'] == "reg" def test_findDupes(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'foo' f['Back'] = u'bar' diff --git a/tests/test_importing.py b/tests/test_importing.py index 322b615f2..841827b51 100644 --- a/tests/test_importing.py +++ b/tests/test_importing.py @@ -1,7 +1,7 @@ # coding: utf-8 import os -from tests.shared import getUpgradeDeckPath, getEmptyDeck +from tests.shared import getUpgradeDeckPath, getEmptyCol from anki.upgrade import Upgrader from anki.utils import ids2str from anki.importing import Anki1Importer, Anki2Importer, TextImporter, \ @@ -27,7 +27,7 @@ def test_anki2(): open(os.path.join(src.media.dir(), "_foo.jpg"), "w").write("foo") src.close() # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() # import src into dst imp = Anki2Importer(dst, srcpath) imp.run() @@ -50,7 +50,7 @@ def test_anki2(): assert len(os.listdir(dst.media.dir())) == 1 def test_anki2_mediadupes(): - tmp = getEmptyDeck() + tmp = getEmptyCol() # add a note that references a sound n = tmp.newNote() n['Front'] = "[sound:foo.mp3]" @@ -60,7 +60,7 @@ def test_anki2_mediadupes(): open(os.path.join(tmp.media.dir(), "foo.mp3"), "w").write("foo") tmp.close() # it should be imported correctly into an empty deck - empty = getEmptyDeck() + empty = getEmptyCol() imp = Anki2Importer(empty, tmp.path) imp.run() assert os.listdir(empty.media.dir()) == ["foo.mp3"] @@ -95,7 +95,7 @@ def test_anki2_mediadupes(): assert "_" in n.fields[0] def test_apkg(): - tmp = getEmptyDeck() + tmp = getEmptyCol() apkg = unicode(os.path.join(testDir, "support/media.apkg")) imp = AnkiPackageImporter(tmp, apkg) assert os.listdir(tmp.media.dir()) == [] @@ -122,7 +122,7 @@ def test_anki1(): os.mkdir(mdir) open(os.path.join(mdir, "_foo.jpg"), "w").write("foo") # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() # import src into dst imp = Anki1Importer(dst, tmp) imp.run() @@ -138,7 +138,7 @@ def test_anki1(): def test_anki1_diffmodels(): # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() # import the 1 card version of the model tmp = getUpgradeDeckPath("diffmodels1.anki") imp = Anki1Importer(dst, tmp) @@ -165,7 +165,7 @@ def test_anki1_diffmodels(): def test_suspended(): # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() # import the 1 card version of the model tmp = getUpgradeDeckPath("suspended12.anki") imp = Anki1Importer(dst, tmp) @@ -174,7 +174,7 @@ def test_suspended(): def test_anki2_diffmodels(): # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() # import the 1 card version of the model tmp = getUpgradeDeckPath("diffmodels2-1.apkg") imp = AnkiPackageImporter(dst, tmp) @@ -206,7 +206,7 @@ def test_anki2_diffmodels(): def test_anki2_updates(): # create a new empty deck - dst = getEmptyDeck() + dst = getEmptyCol() tmp = getUpgradeDeckPath("update1.apkg") imp = AnkiPackageImporter(dst, tmp) imp.run() @@ -232,7 +232,7 @@ def test_anki2_updates(): assert dst.db.scalar("select flds from notes").startswith("goodbye") def test_csv(): - deck = getEmptyDeck() + deck = getEmptyCol() file = unicode(os.path.join(testDir, "support/text-2fields.txt")) i = TextImporter(deck, file) i.initMapping() @@ -266,7 +266,7 @@ def test_csv(): deck.close() def test_csv2(): - deck = getEmptyDeck() + deck = getEmptyCol() mm = deck.models m = mm.current() f = mm.newField("Three") @@ -289,7 +289,7 @@ def test_csv2(): deck.close() def test_supermemo_xml_01_unicode(): - deck = getEmptyDeck() + deck = getEmptyCol() file = unicode(os.path.join(testDir, "support/supermemo1.xml")) i = SupermemoXmlImporter(deck, file) #i.META.logToStdOutput = True @@ -303,7 +303,7 @@ def test_supermemo_xml_01_unicode(): deck.close() def test_mnemo(): - deck = getEmptyDeck() + deck = getEmptyCol() file = unicode(os.path.join(testDir, "support/mnemo.db")) i = MnemosyneImporter(deck, file) i.run() diff --git a/tests/test_latex.py b/tests/test_latex.py index 5af8c5478..9599d4556 100644 --- a/tests/test_latex.py +++ b/tests/test_latex.py @@ -1,11 +1,11 @@ # coding: utf-8 import os -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol from anki.utils import stripHTML def test_latex(): - d = getEmptyDeck() + d = getEmptyCol() # change latex cmd to simulate broken build import anki.latex anki.latex.latexCmds[0][0] = "nolatex" diff --git a/tests/test_media.py b/tests/test_media.py index e47ac8454..243c21516 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -4,12 +4,12 @@ import tempfile import os import time -from shared import getEmptyDeck, testDir +from shared import getEmptyCol, testDir # copying files to media folder def test_add(): - d = getEmptyDeck() + d = getEmptyCol() dir = tempfile.mkdtemp(prefix="anki") path = os.path.join(dir, u"foo.jpg") open(path, "w").write("hello") @@ -22,7 +22,7 @@ def test_add(): assert d.media.addFile(path) == "foo (1).jpg" def test_strings(): - d = getEmptyDeck() + d = getEmptyCol() mf = d.media.filesInStr mid = d.models.models.keys()[0] assert mf(mid, "aoeu") == [] @@ -46,7 +46,7 @@ def test_strings(): assert es('') == '' def test_deckIntegration(): - d = getEmptyDeck() + d = getEmptyCol() # create a media dir d.media.dir() # put a file into it @@ -68,7 +68,7 @@ def test_deckIntegration(): assert ret[1] == ["foo.jpg"] def test_changes(): - d = getEmptyDeck() + d = getEmptyCol() assert d.media._changed() def added(): return d.media.db.execute("select fname from log where type = 0") @@ -103,7 +103,7 @@ def test_changes(): assert len(list(d.media.removed())) == 1 def test_illegal(): - d = getEmptyDeck() + d = getEmptyCol() aString = u"a:b|cd\\e/f\0g*h" good = u"abcdefgh" assert d.media.stripIllegal(aString) == good diff --git a/tests/test_models.py b/tests/test_models.py index 3db14e1c7..3a610df84 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,10 +1,10 @@ # coding: utf-8 -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol from anki.utils import stripHTML, joinFields def test_modelDelete(): - deck = getEmptyDeck() + deck = getEmptyCol() f = deck.newNote() f['Front'] = u'1' f['Back'] = u'2' @@ -14,7 +14,7 @@ def test_modelDelete(): assert deck.cardCount() == 0 def test_modelCopy(): - deck = getEmptyDeck() + deck = getEmptyCol() m = deck.models.current() m2 = deck.models.copy(m) assert m2['name'] == "Basic copy" @@ -27,7 +27,7 @@ def test_modelCopy(): assert deck.models.scmhash(m) == deck.models.scmhash(m2) def test_fields(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u'1' f['Back'] = u'2' @@ -74,7 +74,7 @@ def test_fields(): assert d.getNote(d.models.nids(m)[0]).fields == ["", "2", "1"] def test_templates(): - d = getEmptyDeck() + d = getEmptyCol() m = d.models.current(); mm = d.models t = mm.newTemplate("Reverse") t['qfmt'] = "{{Back}}" @@ -108,7 +108,7 @@ def test_templates(): assert not d.models.remTemplate(m, m['tmpls'][0]) def test_cloze_ordinals(): - d = getEmptyDeck() + d = getEmptyCol() d.models.setCurrent(d.models.byName("Cloze")) m = d.models.current(); mm = d.models @@ -131,7 +131,7 @@ def test_cloze_ordinals(): def test_text(): - d = getEmptyDeck() + d = getEmptyCol() m = d.models.current() m['tmpls'][0]['qfmt'] = "{{text:Front}}" d.models.save(m) @@ -141,7 +141,7 @@ def test_text(): assert "helloworld" in f.cards()[0].q() def test_cloze(): - d = getEmptyDeck() + d = getEmptyCol() d.models.setCurrent(d.models.byName("Cloze")) f = d.newNote() assert f.model()['name'] == "Cloze" @@ -187,7 +187,7 @@ def test_cloze(): assert len(f.cards()) == 2 def test_chained_mods(): - d = getEmptyDeck() + d = getEmptyCol() d.models.setCurrent(d.models.byName("Cloze")) m = d.models.current(); mm = d.models @@ -210,7 +210,7 @@ def test_chained_mods(): assert "This phrase demonstrates en chaine clozes." in f.cards()[0].a() def test_modelChange(): - deck = getEmptyDeck() + deck = getEmptyCol() basic = deck.models.byName("Basic") cloze = deck.models.byName("Cloze") # enable second template and add a note @@ -284,7 +284,7 @@ def test_modelChange(): assert deck.db.scalar("select count() from cards where nid = ?", f.id) == 1 def test_availOrds(): - d = getEmptyDeck() + d = getEmptyCol() m = d.models.current(); mm = d.models t = m['tmpls'][0] f = d.newNote() diff --git a/tests/test_sched.py b/tests/test_sched.py index 644876a4c..3a6429842 100644 --- a/tests/test_sched.py +++ b/tests/test_sched.py @@ -3,13 +3,13 @@ import time import copy -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol from anki.utils import intTime from anki.hooks import addHook def test_clock(): - d = getEmptyDeck() + d = getEmptyCol() if (d.sched.dayCutoff - intTime()) < 10*60: raise Exception("Unit tests will fail around the day rollover.") @@ -18,12 +18,12 @@ def checkRevIvl(d, c, targetIvl): return min <= c.ivl <= max def test_basics(): - d = getEmptyDeck() + d = getEmptyCol() d.reset() assert not d.sched.getCard() def test_new(): - d = getEmptyDeck() + d = getEmptyCol() d.reset() assert d.sched.newCount == 0 # add a note @@ -65,7 +65,7 @@ def test_new(): d.sched.answerCard(c, 2) def test_newLimits(): - d = getEmptyDeck() + d = getEmptyCol() # add some notes g2 = d.decks.id("Default::foo") for i in range(30): @@ -95,7 +95,7 @@ def test_newLimits(): assert d.sched.newCount == 9 def test_newBoxes(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -108,7 +108,7 @@ def test_newBoxes(): d.sched.answerCard(c, 2) def test_learn(): - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one"; f['Back'] = u"two" @@ -182,7 +182,7 @@ def test_learn(): assert c.due == 321 def test_learn_collapsed(): - d = getEmptyDeck() + d = getEmptyCol() # add 2 notes f = d.newNote() f['Front'] = u"1" @@ -208,7 +208,7 @@ def test_learn_collapsed(): assert not c.q().endswith("2") def test_learn_day(): - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one" @@ -266,7 +266,7 @@ def test_learn_day(): assert d.sched.counts() == (0, 0, 0) def test_reviews(): - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one"; f['Back'] = u"two" @@ -358,7 +358,7 @@ def test_reviews(): assert c.queue == -1 def test_button_spacing(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -380,7 +380,7 @@ def test_button_spacing(): def test_overdue_lapse(): # disabled in commit 3069729776990980f34c25be66410e947e9d51a2 return - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one" @@ -413,7 +413,7 @@ def test_overdue_lapse(): assert d.sched.counts() == (0, 0, 1) def test_finished(): - d = getEmptyDeck() + d = getEmptyCol() # nothing due assert "Congratulations" in d.sched.finishedMsg() assert "limit" not in d.sched.finishedMsg() @@ -432,7 +432,7 @@ def test_finished(): assert "limit" not in d.sched.finishedMsg() def test_nextIvl(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one"; f['Back'] = u"two" d.addNote(f) @@ -488,7 +488,7 @@ def test_nextIvl(): assert d.sched.nextIvlStr(c, 4) == "10.8 months" def test_misc(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -502,7 +502,7 @@ def test_misc(): assert d.sched.getCard() def test_suspend(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -545,7 +545,7 @@ def test_suspend(): assert c.did == 1 def test_cram(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -653,7 +653,7 @@ def test_cram(): assert c.did == 1 def test_cram_rem(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -674,7 +674,7 @@ def test_cram_rem(): def test_cram_resched(): # add card - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -778,7 +778,7 @@ def test_cram_resched(): # print c.__dict__ def test_ordcycle(): - d = getEmptyDeck() + d = getEmptyCol() # add two more templates and set second active m = d.models.current(); mm = d.models t = mm.newTemplate("Reverse") @@ -802,7 +802,7 @@ def test_ordcycle(): assert d.sched.getCard().ord == 2 def test_counts_idx(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one"; f['Back'] = u"two" d.addNote(f) @@ -824,7 +824,7 @@ def test_counts_idx(): assert d.sched.counts() == (0, 2, 0) def test_repCounts(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -876,7 +876,7 @@ def test_repCounts(): assert d.sched.counts() == (0, 1, 0) def test_timing(): - d = getEmptyDeck() + d = getEmptyCol() # add a few review cards, due today for i in range(5): f = d.newNote() @@ -902,7 +902,7 @@ def test_timing(): assert c.queue == 1 def test_collapse(): - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one" @@ -916,7 +916,7 @@ def test_collapse(): assert not d.sched.getCard() def test_deckDue(): - d = getEmptyDeck() + d = getEmptyCol() # add a note with default deck f = d.newNote() f['Front'] = u"one" @@ -966,7 +966,7 @@ def test_deckDue(): d.sched.deckDueTree() def test_deckTree(): - d = getEmptyDeck() + d = getEmptyCol() d.decks.id("new::b::c") d.decks.id("new2") # new should not appear twice in tree @@ -975,7 +975,7 @@ def test_deckTree(): assert "new" not in names def test_deckFlow(): - d = getEmptyDeck() + d = getEmptyCol() # add a note with default deck f = d.newNote() f['Front'] = u"one" @@ -999,7 +999,7 @@ def test_deckFlow(): d.sched.answerCard(c, 2) def test_reorder(): - d = getEmptyDeck() + d = getEmptyCol() # add a note with default deck f = d.newNote() f['Front'] = u"one" @@ -1037,7 +1037,7 @@ def test_reorder(): assert f4.cards()[0].due == 2 def test_forget(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -1051,7 +1051,7 @@ def test_forget(): assert d.sched.counts() == (1, 0, 0) def test_resched(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one" d.addNote(f) @@ -1067,7 +1067,7 @@ def test_resched(): assert c.ivl == +1 def test_norelearn(): - d = getEmptyDeck() + d = getEmptyCol() # add a note f = d.newNote() f['Front'] = u"one" @@ -1088,7 +1088,7 @@ def test_norelearn(): d.sched.answerCard(c, 1) def test_failmult(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = u"one"; f['Back'] = u"two" d.addNote(f) diff --git a/tests/test_stats.py b/tests/test_stats.py index b043c2d3b..712bd4bf4 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -1,10 +1,10 @@ # coding: utf-8 import os -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol def test_stats(): - d = getEmptyDeck() + d = getEmptyCol() f = d.newNote() f['Front'] = "foo" d.addNote(f) @@ -18,7 +18,7 @@ def test_stats(): assert d.cardStats(c) def test_graphs_empty(): - d = getEmptyDeck() + d = getEmptyCol() assert d.stats().report() def test_graphs(): diff --git a/tests/test_sync.py b/tests/test_sync.py index 5d26769c7..72ab99701 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -5,7 +5,7 @@ import nose, os, shutil, time from anki import Collection as aopen, Collection from anki.utils import intTime from anki.sync import Syncer, LocalServer -from tests.shared import getEmptyDeck, getEmptyDeckWith +from tests.shared import getEmptyCol, getEmptyDeckWith # Local tests ########################################################################## @@ -18,7 +18,7 @@ server2=None def setup_basic(): global deck1, deck2, client, server - deck1 = getEmptyDeck() + deck1 = getEmptyCol() # add a note to deck 1 f = deck1.newNote() f['Front'] = u"foo"; f['Back'] = u"bar"; f.tags = [u"foo"] @@ -247,7 +247,7 @@ def test_threeway2(): anki.notes.intTime = lambda x=1: intTime(1000) def setup(): # create collection 1 with a single note - c1 = getEmptyDeck() + c1 = getEmptyCol() f = c1.newNote() f['Front'] = u"startingpoint" nid = f.id diff --git a/tests/test_undo.py b/tests/test_undo.py index 322f4314a..c329c424e 100644 --- a/tests/test_undo.py +++ b/tests/test_undo.py @@ -1,11 +1,11 @@ # coding: utf-8 import time -from tests.shared import getEmptyDeck +from tests.shared import getEmptyCol from anki.consts import * def test_op(): - d = getEmptyDeck() + d = getEmptyCol() # should have no undo by default assert not d.undoName() # let's adjust a study option @@ -36,7 +36,7 @@ def test_op(): assert d.undoName() == "Review" def test_review(): - d = getEmptyDeck() + d = getEmptyCol() d.conf['counts'] = COUNT_REMAINING f = d.newNote() f['Front'] = u"one"