(self)
| 700 | self.assertIs(t.dst(), None) |
| 701 | |
| 702 | def test_tz_before_only(self): |
| 703 | # From RFC 8536 Section 3.2: |
| 704 | # |
| 705 | # If there are no transitions, local time for all timestamps is |
| 706 | # specified by the TZ string in the footer if present and nonempty; |
| 707 | # otherwise, it is specified by time type 0. |
| 708 | |
| 709 | offsets = [ |
| 710 | ZoneOffset("STD", ZERO, ZERO), |
| 711 | ZoneOffset("DST", ONE_H, ONE_H), |
| 712 | ] |
| 713 | |
| 714 | for offset in offsets: |
| 715 | # Phantom transition to set time type 0. |
| 716 | transitions = [ |
| 717 | ZoneTransition(None, offset, offset), |
| 718 | ] |
| 719 | |
| 720 | after = "" |
| 721 | |
| 722 | zf = self.construct_zone(transitions, after) |
| 723 | zi = self.klass.from_file(zf) |
| 724 | |
| 725 | dts = [ |
| 726 | datetime(1900, 1, 1), |
| 727 | datetime(1970, 1, 1), |
| 728 | datetime(2000, 1, 1), |
| 729 | ] |
| 730 | |
| 731 | for dt in dts: |
| 732 | dt = dt.replace(tzinfo=zi) |
| 733 | with self.subTest(offset=offset, dt=dt): |
| 734 | self.assertEqual(dt.tzname(), offset.tzname) |
| 735 | self.assertEqual(dt.utcoffset(), offset.utcoffset) |
| 736 | self.assertEqual(dt.dst(), offset.dst) |
| 737 | |
| 738 | def test_empty_zone(self): |
| 739 | zf = self.construct_zone([], "") |
nothing calls this directly
no test coverage detected