MCPcopy Index your code
hub / github.com/python/cpython / test_fromisoformat_timezone

Method test_fromisoformat_timezone

Lib/test/datetimetester.py:3490–3513  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3488 self.assertEqual(dt, dt_rt)
3489
3490 def test_fromisoformat_timezone(self):
3491 base_dt = self.theclass(2014, 12, 30, 12, 30, 45, 217456)
3492
3493 tzoffsets = [
3494 timedelta(hours=5), timedelta(hours=2),
3495 timedelta(hours=6, minutes=27),
3496 timedelta(hours=12, minutes=32, seconds=30),
3497 timedelta(hours=2, minutes=4, seconds=9, microseconds=123456)
3498 ]
3499
3500 tzoffsets += [-1 * td for td in tzoffsets]
3501
3502 tzinfos = [None, timezone.utc,
3503 timezone(timedelta(hours=0))]
3504
3505 tzinfos += [timezone(td) for td in tzoffsets]
3506
3507 for tzi in tzinfos:
3508 dt = base_dt.replace(tzinfo=tzi)
3509 dtstr = dt.isoformat()
3510
3511 with self.subTest(tstr=dtstr):
3512 dt_rt = self.theclass.fromisoformat(dtstr)
3513 self.assertEqual(dt_rt, dt)
3514
3515 def test_fromisoformat_separators(self):
3516 separators = [

Callers

nothing calls this directly

Calls 7

timedeltaClass · 0.90
timezoneClass · 0.90
replaceMethod · 0.45
isoformatMethod · 0.45
subTestMethod · 0.45
fromisoformatMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected