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

Method test_tzstr_localized

Lib/test/test_zoneinfo/test_zoneinfo.py:1026–1037  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1024 return self.klass.from_file(zonefile, key=tzstr)
1025
1026 def test_tzstr_localized(self):
1027 for tzstr, cases in self.test_cases.items():
1028 with self.subTest(tzstr=tzstr):
1029 zi = self.zone_from_tzstr(tzstr)
1030
1031 for dt_naive, offset, _ in cases:
1032 dt = dt_naive.replace(tzinfo=zi)
1033
1034 with self.subTest(tzstr=tzstr, dt=dt, offset=offset):
1035 self.assertEqual(dt.tzname(), offset.tzname)
1036 self.assertEqual(dt.utcoffset(), offset.utcoffset)
1037 self.assertEqual(dt.dst(), offset.dst)
1038
1039 def test_tzstr_from_utc(self):
1040 for tzstr, cases in self.test_cases.items():

Callers

nothing calls this directly

Calls 8

zone_from_tzstrMethod · 0.95
itemsMethod · 0.45
subTestMethod · 0.45
replaceMethod · 0.45
assertEqualMethod · 0.45
tznameMethod · 0.45
utcoffsetMethod · 0.45
dstMethod · 0.45

Tested by

no test coverage detected