mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
0f261583ba
commit
32318930da
5 changed files with 84 additions and 13 deletions
|
@ -2147,6 +2147,10 @@ class TestDateTime(TestDate):
|
|||
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])):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue