(self)
| 2862 | self.assertEqual(t.microsecond, 7812) |
| 2863 | |
| 2864 | def test_timestamp_limits(self): |
| 2865 | with self.subTest("minimum UTC"): |
| 2866 | min_dt = self.theclass.min.replace(tzinfo=timezone.utc) |
| 2867 | min_ts = min_dt.timestamp() |
| 2868 | |
| 2869 | # This test assumes that datetime.min == 0000-01-01T00:00:00.00 |
| 2870 | # If that assumption changes, this value can change as well |
| 2871 | self.assertEqual(min_ts, -62135596800) |
| 2872 | |
| 2873 | with self.subTest("maximum UTC"): |
| 2874 | # Zero out microseconds to avoid rounding issues |
| 2875 | max_dt = self.theclass.max.replace(tzinfo=timezone.utc, |
| 2876 | microsecond=0) |
| 2877 | max_ts = max_dt.timestamp() |
| 2878 | |
| 2879 | # This test assumes that datetime.max == 9999-12-31T23:59:59.999999 |
| 2880 | # If that assumption changes, this value can change as well |
| 2881 | self.assertEqual(max_ts, 253402300799.0) |
| 2882 | |
| 2883 | @unittest.skipIf(sys.platform == "win32", "Windows doesn't support min timestamp") |
| 2884 | def test_fromtimestamp_limits(self): |
nothing calls this directly
no test coverage detected