Added more tests for parse_time().

This commit is contained in:
Keryn Knight 2021-07-06 08:32:44 +02:00 committed by Mariusz Felisiak
parent 14518ccf75
commit 857320e9e0
1 changed files with 5 additions and 0 deletions

View File

@ -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('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
self.assertIsNone(parse_time('091500'))
with self.assertRaises(ValueError):