mirror of https://github.com/django/django.git
Added more tests for parse_time().
This commit is contained in:
parent
14518ccf75
commit
857320e9e0
|
@ -25,6 +25,11 @@ class DateParseTests(unittest.TestCase):
|
||||||
self.assertEqual(parse_time('10:20:30.400'), time(10, 20, 30, 400000))
|
self.assertEqual(parse_time('10:20:30.400'), time(10, 20, 30, 400000))
|
||||||
self.assertEqual(parse_time('10:20:30,400'), time(10, 20, 30, 400000))
|
self.assertEqual(parse_time('10:20:30,400'), time(10, 20, 30, 400000))
|
||||||
self.assertEqual(parse_time('4:8:16'), time(4, 8, 16))
|
self.assertEqual(parse_time('4:8:16'), time(4, 8, 16))
|
||||||
|
# Time zone offset is ignored.
|
||||||
|
self.assertEqual(parse_time('00:05:23+04:00'), time(0, 5, 23))
|
||||||
|
# These should be invalid, see #32904.
|
||||||
|
self.assertEqual(parse_time('00:05:'), time(0, 5))
|
||||||
|
self.assertEqual(parse_time('4:18:101'), time(4, 18, 10))
|
||||||
# Invalid inputs
|
# Invalid inputs
|
||||||
self.assertIsNone(parse_time('091500'))
|
self.assertIsNone(parse_time('091500'))
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
|
|
Loading…
Reference in New Issue