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

Method test_one_zone_dst

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

Source from the content-addressed store, hash-verified

631 self.assertEqual(dt_utc_actual, dt_utc)
632
633 def test_one_zone_dst(self):
634 DST = ZoneOffset("DST", ONE_H, ONE_H)
635 transitions = [
636 ZoneTransition(datetime(1970, 1, 1), DST, DST),
637 ]
638
639 after = "STD0DST-1,0/0,J365/25"
640
641 zf = self.construct_zone(transitions, after)
642 zi = self.klass.from_file(zf)
643
644 dts = [
645 datetime(1900, 3, 1),
646 datetime(1965, 9, 12),
647 datetime(1970, 1, 1),
648 datetime(2010, 11, 3),
649 datetime(2040, 1, 1),
650 ]
651
652 for dt in dts:
653 dt = dt.replace(tzinfo=zi)
654 with self.subTest(dt=dt):
655 self.assertEqual(dt.tzname(), DST.tzname)
656 self.assertEqual(dt.utcoffset(), DST.utcoffset)
657 self.assertEqual(dt.dst(), DST.dst)
658
659 def test_no_tz_str(self):
660 STD = ZoneOffset("STD", ONE_H, ZERO)

Callers

nothing calls this directly

Calls 11

construct_zoneMethod · 0.95
datetimeClass · 0.90
ZoneOffsetClass · 0.85
ZoneTransitionClass · 0.85
from_fileMethod · 0.45
replaceMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45
tznameMethod · 0.45
utcoffsetMethod · 0.45
dstMethod · 0.45

Tested by

no test coverage detected