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

Method test_FromSecondsObject

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

Source from the content-addressed store, hash-verified

995 _PyTime_FromSeconds(float('nan'))
996
997 def test_FromSecondsObject(self):
998 from _testinternalcapi import _PyTime_FromSecondsObject
999
1000 self.check_int_rounding(
1001 _PyTime_FromSecondsObject,
1002 lambda secs: secs * SEC_TO_NS)
1003
1004 self.check_float_rounding(
1005 _PyTime_FromSecondsObject,
1006 lambda ns: self.decimal_round(ns * SEC_TO_NS))
1007
1008 # test nan
1009 for time_rnd, _ in ROUNDING_MODES:
1010 with self.assertRaises(ValueError):
1011 _PyTime_FromSecondsObject(float('nan'), time_rnd)
1012
1013 def test_AsSecondsDouble(self):
1014 from _testcapi import PyTime_AsSecondsDouble

Callers

nothing calls this directly

Calls 4

check_int_roundingMethod · 0.80
check_float_roundingMethod · 0.80
decimal_roundMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected