(self)
| 6908 | self.assertEqual(dt1.tzname(), dt2.tzname()) |
| 6909 | |
| 6910 | def test_check_date(self): |
| 6911 | class DateSubclass(date): |
| 6912 | pass |
| 6913 | |
| 6914 | d = date(2011, 1, 1) |
| 6915 | ds = DateSubclass(2011, 1, 1) |
| 6916 | dt = datetime(2011, 1, 1) |
| 6917 | |
| 6918 | is_date = _testcapi.datetime_check_date |
| 6919 | |
| 6920 | # Check the ones that should be valid |
| 6921 | self.assertTrue(is_date(d)) |
| 6922 | self.assertTrue(is_date(dt)) |
| 6923 | self.assertTrue(is_date(ds)) |
| 6924 | self.assertTrue(is_date(d, True)) |
| 6925 | |
| 6926 | # Check that the subclasses do not match exactly |
| 6927 | self.assertFalse(is_date(dt, True)) |
| 6928 | self.assertFalse(is_date(ds, True)) |
| 6929 | |
| 6930 | # Check that various other things are not dates at all |
| 6931 | args = [tuple(), list(), 1, '2011-01-01', |
| 6932 | timedelta(1), timezone.utc, time(12, 00)] |
| 6933 | for arg in args: |
| 6934 | for exact in (True, False): |
| 6935 | with self.subTest(arg=arg, exact=exact): |
| 6936 | self.assertFalse(is_date(arg, exact)) |
| 6937 | |
| 6938 | def test_check_time(self): |
| 6939 | class TimeSubclass(time): |
nothing calls this directly
no test coverage detected