diff options
| author | Mario Corchero <mariocj89@gmail.com> | 2018-01-09 21:37:26 +0000 |
|---|---|---|
| committer | Alexander Belopolsky <abalkin@users.noreply.github.com> | 2018-01-09 16:37:26 -0500 |
| commit | f80c0ca13330112fe4d8018609c085ef556cb5bf (patch) | |
| tree | 652f2e1c70cd8b3e003bee3e92ae8bf8c57b3801 /Lib/test | |
| parent | d4864c61e3e27e337762dc45e504977299bd5b46 (diff) | |
| download | cpython-git-f80c0ca13330112fe4d8018609c085ef556cb5bf.tar.gz | |
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.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_strptime.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 1251886779..af71008bec 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -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) |
