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

Method test_ctime

Lib/test/test_time.py:413–426  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

411 self._bounds_checking(time.asctime)
412
413 def test_ctime(self):
414 t = time.mktime((1973, 9, 16, 1, 3, 52, 0, 0, -1))
415 self.assertEqual(time.ctime(t), 'Sun Sep 16 01:03:52 1973')
416 t = time.mktime((2000, 1, 1, 0, 0, 0, 0, 0, -1))
417 self.assertEqual(time.ctime(t), 'Sat Jan 1 00:00:00 2000')
418 for year in [-100, 100, 1000, 2000, 2050, 10000]:
419 try:
420 testval = time.mktime((year, 1, 10) + (0,)*6)
421 except (ValueError, OverflowError):
422 # If mktime fails, ctime will fail too. This may happen
423 # on some platforms.
424 pass
425 else:
426 self.assertEqual(time.ctime(testval)[20:], str(year))
427
428 @unittest.skipUnless(hasattr(time, "tzset"),
429 "time module has no attribute tzset")

Callers

nothing calls this directly

Calls 3

strFunction · 0.85
assertEqualMethod · 0.45
ctimeMethod · 0.45

Tested by

no test coverage detected