mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
raises error when date string has too many components
This commit is contained in:
parent
3aebb30ad9
commit
8e6909bf4b
2 changed files with 3 additions and 2 deletions
|
|
@ -555,7 +555,7 @@ class Period(object):
|
|||
ordinal = string.count('-')
|
||||
if ordinal >= len(cls.date_formats):
|
||||
# Too many components.
|
||||
return None
|
||||
raise InvalidQueryArgumentTypeError(string, 'a valid datetime string')
|
||||
date_format = cls.date_formats[ordinal]
|
||||
try:
|
||||
date = datetime.strptime(string, date_format)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ class DateQueryConstructTest(unittest.TestCase):
|
|||
DateQuery('added', '1409830085..1412422089')
|
||||
|
||||
def test_too_many_components(self):
|
||||
DateQuery('added', '12-34-56-78')
|
||||
with self.assertRaises(InvalidQueryArgumentTypeError):
|
||||
DateQuery('added', '12-34-56-78')
|
||||
|
||||
|
||||
def suite():
|
||||
|
|
|
|||
Loading…
Reference in a new issue