(self)
| 6907 | hasattr(_time, "tzset"), "time module has no attribute tzset" |
| 6908 | ) |
| 6909 | def test_system_transitions(self): |
| 6910 | if ('Riyadh8' in self.zonename or |
| 6911 | # From tzdata NEWS file: |
| 6912 | # The files solar87, solar88, and solar89 are no longer distributed. |
| 6913 | # They were a negative experiment - that is, a demonstration that |
| 6914 | # tz data can represent solar time only with some difficulty and error. |
| 6915 | # Their presence in the distribution caused confusion, as Riyadh |
| 6916 | # civil time was generally not solar time in those years. |
| 6917 | self.zonename.startswith('right/')): |
| 6918 | self.skipTest("Skipping %s" % self.zonename) |
| 6919 | tz = self.tz |
| 6920 | with self._change_tz(self.zonename): |
| 6921 | for udt, shift in tz.transitions(): |
| 6922 | if udt.year >= 2037: |
| 6923 | # System support for times around the end of 32-bit time_t |
| 6924 | # and later is flaky on many systems. |
| 6925 | break |
| 6926 | s0 = (udt - datetime(1970, 1, 1)) // SEC |
| 6927 | ss = shift // SEC # shift seconds |
| 6928 | for x in [-40 * 3600, -20 * 3600, -1, 0, |
| 6929 | ss - 1, ss + 20 * 3600, ss + 40 * 3600]: |
| 6930 | s = s0 + x |
| 6931 | sdt = datetime.fromtimestamp(s) |
| 6932 | tzdt = datetime.fromtimestamp(s, tz).replace(tzinfo=None) |
| 6933 | self.assertEquivDatetimes(sdt, tzdt) |
| 6934 | s1 = sdt.timestamp() |
| 6935 | self.assertEqual(s, s1) |
| 6936 | if ss > 0: # gap |
| 6937 | # Create local time inside the gap |
| 6938 | dt = datetime.fromtimestamp(s0) - shift / 2 |
| 6939 | ts0 = dt.timestamp() |
| 6940 | ts1 = dt.replace(fold=1).timestamp() |
| 6941 | self.assertEqual(ts0, s0 + ss / 2) |
| 6942 | self.assertEqual(ts1, s0 - ss / 2) |
| 6943 | # gh-83861 |
| 6944 | utc0 = dt.astimezone(timezone.utc) |
| 6945 | utc1 = dt.replace(fold=1).astimezone(timezone.utc) |
| 6946 | self.assertEqual(utc0, utc1 + timedelta(0, ss)) |
| 6947 | |
| 6948 | |
| 6949 | class ZoneInfoCompleteTest(unittest.TestSuite): |
nothing calls this directly
no test coverage detected