Kaydet (Commit) 63c1ebb6 authored tarafından Martin Panter's avatar Martin Panter

Issue #25168: Temporary timezone and cache debugging

üst 449e7c1b
......@@ -1979,7 +1979,16 @@ class TestDateTime(TestDate):
seconds = tzseconds
hours, minutes = divmod(seconds//60, 60)
dtstr = "{}{:02d}{:02d} {}".format(sign, hours, minutes, tzname)
dt = strptime(dtstr, "%z %Z")
try:
dt = strptime(dtstr, "%z %Z")
except ValueError:
import os
self.fail(
"Issue #25168 strptime() failure info:\n"
f"_TimeRE_cache['Z']={_strptime._TimeRE_cache['Z']!r}\n"
f"TZ={os.environ.get('TZ')!r}, or {os.getenv('TZ')!r} via getenv()\n"
f"_regex_cache={_strptime._regex_cache!r}\n"
)
self.assertEqual(dt.utcoffset(), timedelta(seconds=tzseconds))
self.assertEqual(dt.tzname(), tzname)
# Can produce inconsistent datetime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment