Merge pull request #353 from Arthur-Milchior/correctFindFlag

Correct find flag
This commit is contained in:
Damien Elmes 2019-11-14 09:20:30 +10:00 committed by GitHub
commit fe599522ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -275,7 +275,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
def _findFlag(self, 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
val = int(val)
mask = 2**3 - 1

View file

@ -224,6 +224,11 @@ def test_findCards():
id)
assert len(deck.findCards("added:1")) == deck.cardCount() - 1
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():
deck = getEmptyCol()