(self)
| 7095 | self.assertEqual(dt1.tzname(), dt2.tzname()) |
| 7096 | |
| 7097 | def test_check_date(self): |
| 7098 | class DateSubclass(date): |
| 7099 | pass |
| 7100 | |
| 7101 | d = date(2011, 1, 1) |
| 7102 | ds = DateSubclass(2011, 1, 1) |
| 7103 | dt = datetime(2011, 1, 1) |
| 7104 | |
| 7105 | is_date = _testcapi.datetime_check_date |
| 7106 | |
| 7107 | # Check the ones that should be valid |
| 7108 | self.assertTrue(is_date(d)) |
| 7109 | self.assertTrue(is_date(dt)) |
| 7110 | self.assertTrue(is_date(ds)) |
| 7111 | self.assertTrue(is_date(d, True)) |
| 7112 | |
| 7113 | # Check that the subclasses do not match exactly |
| 7114 | self.assertFalse(is_date(dt, True)) |
| 7115 | self.assertFalse(is_date(ds, True)) |
| 7116 | |
| 7117 | # Check that various other things are not dates at all |
| 7118 | args = [tuple(), list(), 1, '2011-01-01', |
| 7119 | timedelta(1), timezone.utc, time(12, 00)] |
| 7120 | for arg in args: |
| 7121 | for exact in (True, False): |
| 7122 | with self.subTest(arg=arg, exact=exact): |
| 7123 | self.assertFalse(is_date(arg, exact)) |
| 7124 | |
| 7125 | def test_check_time(self): |
| 7126 | class TimeSubclass(time): |
nothing calls this directly
no test coverage detected