Closes bpo-31800: Support for colon when parsing time offsets (#4015)
Add support to strptime to parse time offsets with a colon between the hour and the minutes.
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 4edfb42..c5f91fb 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -2147,6 +2147,10 @@
strptime = self.theclass.strptime
self.assertEqual(strptime("+0002", "%z").utcoffset(), 2 * MINUTE)
self.assertEqual(strptime("-0002", "%z").utcoffset(), -2 * MINUTE)
+ self.assertEqual(
+ strptime("-00:02:01.000003", "%z").utcoffset(),
+ -timedelta(minutes=2, seconds=1, microseconds=3)
+ )
# Only local timezone and UTC are supported
for tzseconds, tzname in ((0, 'UTC'), (0, 'GMT'),
(-_time.timezone, _time.tzname[0])):