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

Method test_FromSeconds

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

Source from the content-addressed store, hash-verified

979 OVERFLOW_SECONDS = math.ceil((2**63 + 1) / SEC_TO_NS)
980
981 def test_FromSeconds(self):
982 from _testinternalcapi import _PyTime_FromSeconds
983
984 # _PyTime_FromSeconds() expects a C int, reject values out of range
985 def c_int_filter(secs):
986 return (_testcapi.INT_MIN <= secs <= _testcapi.INT_MAX)
987
988 self.check_int_rounding(lambda secs, rnd: _PyTime_FromSeconds(secs),
989 lambda secs: secs * SEC_TO_NS,
990 value_filter=c_int_filter)
991
992 # test nan
993 for time_rnd, _ in ROUNDING_MODES:
994 with self.assertRaises(TypeError):
995 _PyTime_FromSeconds(float('nan'))
996
997 def test_FromSecondsObject(self):
998 from _testinternalcapi import _PyTime_FromSecondsObject

Callers

nothing calls this directly

Calls 2

check_int_roundingMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected