MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_check_time

Method test_check_time

Lib/test/datetimetester.py:6938–6962  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6936 self.assertFalse(is_date(arg, exact))
6937
6938 def test_check_time(self):
6939 class TimeSubclass(time):
6940 pass
6941
6942 t = time(12, 30)
6943 ts = TimeSubclass(12, 30)
6944
6945 is_time = _testcapi.datetime_check_time
6946
6947 # Check the ones that should be valid
6948 self.assertTrue(is_time(t))
6949 self.assertTrue(is_time(ts))
6950 self.assertTrue(is_time(t, True))
6951
6952 # Check that the subclass does not match exactly
6953 self.assertFalse(is_time(ts, True))
6954
6955 # Check that various other things are not times
6956 args = [tuple(), list(), 1, '2011-01-01',
6957 timedelta(1), timezone.utc, date(2011, 1, 1)]
6958
6959 for arg in args:
6960 for exact in (True, False):
6961 with self.subTest(arg=arg, exact=exact):
6962 self.assertFalse(is_time(arg, exact))
6963
6964 def test_check_datetime(self):
6965 class DateTimeSubclass(datetime):

Callers

nothing calls this directly

Calls 8

timeClass · 0.90
timedeltaClass · 0.90
dateClass · 0.90
listClass · 0.85
assertTrueMethod · 0.80
assertFalseMethod · 0.80
subTestMethod · 0.80
TimeSubclassClass · 0.70

Tested by

no test coverage detected