mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Test special characters in tag search
This commit is contained in:
parent
491b8ea63f
commit
62a76b3ad9
1 changed files with 8 additions and 2 deletions
|
@ -25,14 +25,14 @@ def test_findCards():
|
||||||
f = deck.newNote()
|
f = deck.newNote()
|
||||||
f['Front'] = 'dog'
|
f['Front'] = 'dog'
|
||||||
f['Back'] = 'cat'
|
f['Back'] = 'cat'
|
||||||
f.tags.append("monkey")
|
f.tags.append("monkey animal_1 * %")
|
||||||
f1id = f.id
|
f1id = f.id
|
||||||
deck.addNote(f)
|
deck.addNote(f)
|
||||||
firstCardId = f.cards()[0].id
|
firstCardId = f.cards()[0].id
|
||||||
f = deck.newNote()
|
f = deck.newNote()
|
||||||
f['Front'] = 'goats are fun'
|
f['Front'] = 'goats are fun'
|
||||||
f['Back'] = 'sheep'
|
f['Back'] = 'sheep'
|
||||||
f.tags.append("sheep goat horse")
|
f.tags.append("sheep goat horse animal11")
|
||||||
deck.addNote(f)
|
deck.addNote(f)
|
||||||
f2id = f.id
|
f2id = f.id
|
||||||
f = deck.newNote()
|
f = deck.newNote()
|
||||||
|
@ -52,6 +52,12 @@ def test_findCards():
|
||||||
deck.addNote(f)
|
deck.addNote(f)
|
||||||
latestCardIds = [c.id for c in f.cards()]
|
latestCardIds = [c.id for c in f.cards()]
|
||||||
# tag searches
|
# tag searches
|
||||||
|
assert len(deck.findCards("tag:*")) == 5
|
||||||
|
assert len(deck.findCards("tag:\\*")) == 1
|
||||||
|
assert len(deck.findCards("tag:%")) == 5
|
||||||
|
assert len(deck.findCards("tag:\\%")) == 1
|
||||||
|
assert len(deck.findCards("tag:animal_1")) == 2
|
||||||
|
assert len(deck.findCards("tag:animal\\_1")) == 1
|
||||||
assert not deck.findCards("tag:donkey")
|
assert not deck.findCards("tag:donkey")
|
||||||
assert len(deck.findCards("tag:sheep")) == 1
|
assert len(deck.findCards("tag:sheep")) == 1
|
||||||
assert len(deck.findCards("tag:sheep tag:goat")) == 1
|
assert len(deck.findCards("tag:sheep tag:goat")) == 1
|
||||||
|
|
Loading…
Reference in a new issue