MCPcopy Index your code
hub / github.com/python/cpython / test_check_time

Method test_check_time

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

Source from the content-addressed store, hash-verified

7123 self.assertFalse(is_date(arg, exact))
7124
7125 def test_check_time(self):
7126 class TimeSubclass(time):
7127 pass
7128
7129 t = time(12, 30)
7130 ts = TimeSubclass(12, 30)
7131
7132 is_time = _testcapi.datetime_check_time
7133
7134 # Check the ones that should be valid
7135 self.assertTrue(is_time(t))
7136 self.assertTrue(is_time(ts))
7137 self.assertTrue(is_time(t, True))
7138
7139 # Check that the subclass does not match exactly
7140 self.assertFalse(is_time(ts, True))
7141
7142 # Check that various other things are not times
7143 args = [tuple(), list(), 1, '2011-01-01',
7144 timedelta(1), timezone.utc, date(2011, 1, 1)]
7145
7146 for arg in args:
7147 for exact in (True, False):
7148 with self.subTest(arg=arg, exact=exact):
7149 self.assertFalse(is_time(arg, exact))
7150
7151 def test_check_datetime(self):
7152 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
TimeSubclassClass · 0.70
subTestMethod · 0.45

Tested by

no test coverage detected