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

Method test_AsTimeval

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

Source from the content-addressed store, hash-verified

1033 return converter
1034
1035 def test_AsTimeval(self):
1036 from _testinternalcapi import _PyTime_AsTimeval
1037
1038 us_converter = self.create_decimal_converter(US_TO_NS)
1039
1040 def timeval_converter(ns):
1041 us = us_converter(ns)
1042 return divmod(us, SEC_TO_US)
1043
1044 if sys.platform == 'win32':
1045 from _testcapi import LONG_MIN, LONG_MAX
1046
1047 # On Windows, timeval.tv_sec type is a C long
1048 def seconds_filter(secs):
1049 return LONG_MIN <= secs <= LONG_MAX
1050 else:
1051 seconds_filter = self.time_t_filter
1052
1053 self.check_int_rounding(_PyTime_AsTimeval,
1054 timeval_converter,
1055 NS_TO_SEC,
1056 value_filter=seconds_filter)
1057
1058 @unittest.skipUnless(hasattr(_testinternalcapi, '_PyTime_AsTimespec'),
1059 'need _testinternalcapi._PyTime_AsTimespec')

Callers

nothing calls this directly

Calls 2

check_int_roundingMethod · 0.80

Tested by

no test coverage detected