mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix when parsing tz offsets microseconds shorter than 6 (#4781)
As the remainder was directly parsed as an int, strings like .600 were parsed as 600 microseconds rather than milliseconds.
This commit is contained in:
parent
d4864c61e3
commit
f80c0ca133
2 changed files with 7 additions and 1 deletions
|
@ -345,6 +345,9 @@ class StrptimeTests(unittest.TestCase):
|
|||
(*_, offset), _, offset_fraction = _strptime._strptime("-01:30:30.000001", "%z")
|
||||
self.assertEqual(offset, -(one_hour + half_hour + half_minute))
|
||||
self.assertEqual(offset_fraction, -1)
|
||||
(*_, offset), _, offset_fraction = _strptime._strptime("+01:30:30.001", "%z")
|
||||
self.assertEqual(offset, one_hour + half_hour + half_minute)
|
||||
self.assertEqual(offset_fraction, 1000)
|
||||
(*_, offset), _, offset_fraction = _strptime._strptime("Z", "%z")
|
||||
self.assertEqual(offset, 0)
|
||||
self.assertEqual(offset_fraction, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue