mirror of
https://github.com/beetbox/beets.git
synced 2025-12-22 16:43:25 +01:00
fix numeric queries over empty string (fix #547)
This commit is contained in:
parent
5d55312fdb
commit
c196f20dfc
2 changed files with 8 additions and 2 deletions
|
|
@ -225,7 +225,7 @@ class NumericQuery(FieldQuery):
|
|||
elif self.rangemax is not None:
|
||||
return u'{0} <= ?'.format(self.field), (self.rangemax,)
|
||||
else:
|
||||
return '1'
|
||||
return '1', ()
|
||||
|
||||
|
||||
class CollectionQuery(Query):
|
||||
|
|
|
|||
|
|
@ -261,7 +261,8 @@ class GetTest(DummyDataTestCase):
|
|||
|
||||
def test_bad_year(self):
|
||||
q = 'year:delete from items'
|
||||
self.assertRaises(ValueError, self.lib.items, q)
|
||||
results = self.lib.items(q)
|
||||
self.assert_matched(results, [])
|
||||
|
||||
def test_singleton_true(self):
|
||||
q = 'singleton:true'
|
||||
|
|
@ -320,6 +321,11 @@ class GetTest(DummyDataTestCase):
|
|||
results = self.lib.items(q)
|
||||
self.assertFalse(results)
|
||||
|
||||
def test_numeric_empty(self):
|
||||
q = dbcore.query.NumericQuery('year', '')
|
||||
results = self.lib.items(q)
|
||||
self.assertTrue(results)
|
||||
|
||||
|
||||
class MatchTest(_common.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue