(self)
| 7149 | self.assertFalse(is_time(arg, exact)) |
| 7150 | |
| 7151 | def test_check_datetime(self): |
| 7152 | class DateTimeSubclass(datetime): |
| 7153 | pass |
| 7154 | |
| 7155 | dt = datetime(2011, 1, 1, 12, 30) |
| 7156 | dts = DateTimeSubclass(2011, 1, 1, 12, 30) |
| 7157 | |
| 7158 | is_datetime = _testcapi.datetime_check_datetime |
| 7159 | |
| 7160 | # Check the ones that should be valid |
| 7161 | self.assertTrue(is_datetime(dt)) |
| 7162 | self.assertTrue(is_datetime(dts)) |
| 7163 | self.assertTrue(is_datetime(dt, True)) |
| 7164 | |
| 7165 | # Check that the subclass does not match exactly |
| 7166 | self.assertFalse(is_datetime(dts, True)) |
| 7167 | |
| 7168 | # Check that various other things are not datetimes |
| 7169 | args = [tuple(), list(), 1, '2011-01-01', |
| 7170 | timedelta(1), timezone.utc, date(2011, 1, 1)] |
| 7171 | |
| 7172 | for arg in args: |
| 7173 | for exact in (True, False): |
| 7174 | with self.subTest(arg=arg, exact=exact): |
| 7175 | self.assertFalse(is_datetime(arg, exact)) |
| 7176 | |
| 7177 | def test_check_delta(self): |
| 7178 | class TimeDeltaSubclass(timedelta): |
nothing calls this directly
no test coverage detected