(self)
| 6962 | self.assertFalse(is_time(arg, exact)) |
| 6963 | |
| 6964 | def test_check_datetime(self): |
| 6965 | class DateTimeSubclass(datetime): |
| 6966 | pass |
| 6967 | |
| 6968 | dt = datetime(2011, 1, 1, 12, 30) |
| 6969 | dts = DateTimeSubclass(2011, 1, 1, 12, 30) |
| 6970 | |
| 6971 | is_datetime = _testcapi.datetime_check_datetime |
| 6972 | |
| 6973 | # Check the ones that should be valid |
| 6974 | self.assertTrue(is_datetime(dt)) |
| 6975 | self.assertTrue(is_datetime(dts)) |
| 6976 | self.assertTrue(is_datetime(dt, True)) |
| 6977 | |
| 6978 | # Check that the subclass does not match exactly |
| 6979 | self.assertFalse(is_datetime(dts, True)) |
| 6980 | |
| 6981 | # Check that various other things are not datetimes |
| 6982 | args = [tuple(), list(), 1, '2011-01-01', |
| 6983 | timedelta(1), timezone.utc, date(2011, 1, 1)] |
| 6984 | |
| 6985 | for arg in args: |
| 6986 | for exact in (True, False): |
| 6987 | with self.subTest(arg=arg, exact=exact): |
| 6988 | self.assertFalse(is_datetime(arg, exact)) |
| 6989 | |
| 6990 | def test_check_delta(self): |
| 6991 | class TimeDeltaSubclass(timedelta): |
nothing calls this directly
no test coverage detected