mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
Merge pull request #353 from Arthur-Milchior/correctFindFlag
Correct find flag
This commit is contained in:
commit
fe599522ef
2 changed files with 6 additions and 1 deletions
|
|
@ -275,7 +275,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
||||||
|
|
||||||
def _findFlag(self, args):
|
def _findFlag(self, args):
|
||||||
(val, args) = args
|
(val, args) = args
|
||||||
if not val or val not in "01234":
|
if not val or len(val)!=1 or val not in "01234":
|
||||||
return
|
return
|
||||||
val = int(val)
|
val = int(val)
|
||||||
mask = 2**3 - 1
|
mask = 2**3 - 1
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,11 @@ def test_findCards():
|
||||||
id)
|
id)
|
||||||
assert len(deck.findCards("added:1")) == deck.cardCount() - 1
|
assert len(deck.findCards("added:1")) == deck.cardCount() - 1
|
||||||
assert len(deck.findCards("added:2")) == deck.cardCount()
|
assert len(deck.findCards("added:2")) == deck.cardCount()
|
||||||
|
# flag
|
||||||
|
with assert_raises(Exception):
|
||||||
|
deck.findCards("flag:01")
|
||||||
|
with assert_raises(Exception):
|
||||||
|
deck.findCards("flag:12")
|
||||||
|
|
||||||
def test_findReplace():
|
def test_findReplace():
|
||||||
deck = getEmptyCol()
|
deck = getEmptyCol()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue