mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
f2->note2 in test
Obtained by ``` sed -i "s/\bf2\b/note2/g" pylib/tests/*py qt/tests/*py ```
This commit is contained in:
parent
4c25835d27
commit
425b82e6e7
4 changed files with 39 additions and 39 deletions
|
@ -74,13 +74,13 @@ def test_noteAddDelete():
|
|||
# it should not be a duplicate
|
||||
assert not note.dupeOrEmpty()
|
||||
# now let's make a duplicate
|
||||
f2 = deck.newNote()
|
||||
f2["Front"] = "one"
|
||||
f2["Back"] = ""
|
||||
assert f2.dupeOrEmpty()
|
||||
note2 = deck.newNote()
|
||||
note2["Front"] = "one"
|
||||
note2["Back"] = ""
|
||||
assert note2.dupeOrEmpty()
|
||||
# empty first field should not be permitted either
|
||||
f2["Front"] = " "
|
||||
assert f2.dupeOrEmpty()
|
||||
note2["Front"] = " "
|
||||
assert note2.dupeOrEmpty()
|
||||
|
||||
|
||||
def test_fieldChecksum():
|
||||
|
@ -101,15 +101,15 @@ def test_addDelTags():
|
|||
note = deck.newNote()
|
||||
note["Front"] = "1"
|
||||
deck.addNote(note)
|
||||
f2 = deck.newNote()
|
||||
f2["Front"] = "2"
|
||||
deck.addNote(f2)
|
||||
note2 = deck.newNote()
|
||||
note2["Front"] = "2"
|
||||
deck.addNote(note2)
|
||||
# adding for a given id
|
||||
deck.tags.bulkAdd([note.id], "foo")
|
||||
note.load()
|
||||
f2.load()
|
||||
note2.load()
|
||||
assert "foo" in note.tags
|
||||
assert "foo" not in f2.tags
|
||||
assert "foo" not in note2.tags
|
||||
# should be canonified
|
||||
deck.tags.bulkAdd([note.id], "foo aaa")
|
||||
note.load()
|
||||
|
|
|
@ -235,25 +235,25 @@ def test_findReplace():
|
|||
note["Front"] = "foo"
|
||||
note["Back"] = "bar"
|
||||
deck.addNote(note)
|
||||
f2 = deck.newNote()
|
||||
f2["Front"] = "baz"
|
||||
f2["Back"] = "foo"
|
||||
deck.addNote(f2)
|
||||
nids = [note.id, f2.id]
|
||||
note2 = deck.newNote()
|
||||
note2["Front"] = "baz"
|
||||
note2["Back"] = "foo"
|
||||
deck.addNote(note2)
|
||||
nids = [note.id, note2.id]
|
||||
# should do nothing
|
||||
assert deck.findReplace(nids, "abc", "123") == 0
|
||||
# global replace
|
||||
assert deck.findReplace(nids, "foo", "qux") == 2
|
||||
note.load()
|
||||
assert note["Front"] == "qux"
|
||||
f2.load()
|
||||
assert f2["Back"] == "qux"
|
||||
note2.load()
|
||||
assert note2["Back"] == "qux"
|
||||
# single field replace
|
||||
assert deck.findReplace(nids, "qux", "foo", field="Front") == 1
|
||||
note.load()
|
||||
assert note["Front"] == "foo"
|
||||
f2.load()
|
||||
assert f2["Back"] == "qux"
|
||||
note2.load()
|
||||
assert note2["Back"] == "qux"
|
||||
# regex replace
|
||||
assert deck.findReplace(nids, "B.r", "reg") == 0
|
||||
note.load()
|
||||
|
@ -269,10 +269,10 @@ def test_findDupes():
|
|||
note["Front"] = "foo"
|
||||
note["Back"] = "bar"
|
||||
deck.addNote(note)
|
||||
f2 = deck.newNote()
|
||||
f2["Front"] = "baz"
|
||||
f2["Back"] = "bar"
|
||||
deck.addNote(f2)
|
||||
note2 = deck.newNote()
|
||||
note2["Front"] = "baz"
|
||||
note2["Back"] = "bar"
|
||||
deck.addNote(note2)
|
||||
f3 = deck.newNote()
|
||||
f3["Front"] = "quux"
|
||||
f3["Back"] = "bar"
|
||||
|
|
|
@ -1051,10 +1051,10 @@ def test_reorder():
|
|||
note = d.newNote()
|
||||
note["Front"] = "one"
|
||||
d.addNote(note)
|
||||
f2 = d.newNote()
|
||||
f2["Front"] = "two"
|
||||
d.addNote(f2)
|
||||
assert f2.cards()[0].due == 2
|
||||
note2 = d.newNote()
|
||||
note2["Front"] = "two"
|
||||
d.addNote(note2)
|
||||
assert note2.cards()[0].due == 2
|
||||
found = False
|
||||
# 50/50 chance of being reordered
|
||||
for i in range(20):
|
||||
|
@ -1073,12 +1073,12 @@ def test_reorder():
|
|||
f4["Front"] = "four"
|
||||
d.addNote(f4)
|
||||
assert note.cards()[0].due == 1
|
||||
assert f2.cards()[0].due == 2
|
||||
assert note2.cards()[0].due == 2
|
||||
assert f3.cards()[0].due == 3
|
||||
assert f4.cards()[0].due == 4
|
||||
d.sched.sortCards([f3.cards()[0].id, f4.cards()[0].id], start=1, shift=True)
|
||||
assert note.cards()[0].due == 3
|
||||
assert f2.cards()[0].due == 4
|
||||
assert note2.cards()[0].due == 4
|
||||
assert f3.cards()[0].due == 1
|
||||
assert f4.cards()[0].due == 2
|
||||
|
||||
|
|
|
@ -810,9 +810,9 @@ def test_preview():
|
|||
d.addNote(note)
|
||||
c = note.cards()[0]
|
||||
orig = copy.copy(c)
|
||||
f2 = d.newNote()
|
||||
f2["Front"] = "two"
|
||||
d.addNote(f2)
|
||||
note2 = d.newNote()
|
||||
note2["Front"] = "two"
|
||||
d.addNote(note2)
|
||||
# cram deck
|
||||
did = d.decks.newDyn("Cram")
|
||||
cram = d.decks.get(did)
|
||||
|
@ -1085,10 +1085,10 @@ def test_reorder():
|
|||
note = d.newNote()
|
||||
note["Front"] = "one"
|
||||
d.addNote(note)
|
||||
f2 = d.newNote()
|
||||
f2["Front"] = "two"
|
||||
d.addNote(f2)
|
||||
assert f2.cards()[0].due == 2
|
||||
note2 = d.newNote()
|
||||
note2["Front"] = "two"
|
||||
d.addNote(note2)
|
||||
assert note2.cards()[0].due == 2
|
||||
found = False
|
||||
# 50/50 chance of being reordered
|
||||
for i in range(20):
|
||||
|
@ -1107,12 +1107,12 @@ def test_reorder():
|
|||
f4["Front"] = "four"
|
||||
d.addNote(f4)
|
||||
assert note.cards()[0].due == 1
|
||||
assert f2.cards()[0].due == 2
|
||||
assert note2.cards()[0].due == 2
|
||||
assert f3.cards()[0].due == 3
|
||||
assert f4.cards()[0].due == 4
|
||||
d.sched.sortCards([f3.cards()[0].id, f4.cards()[0].id], start=1, shift=True)
|
||||
assert note.cards()[0].due == 3
|
||||
assert f2.cards()[0].due == 4
|
||||
assert note2.cards()[0].due == 4
|
||||
assert f3.cards()[0].due == 1
|
||||
assert f4.cards()[0].due == 2
|
||||
|
||||
|
|
Loading…
Reference in a new issue