diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-03 13:10:54 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-03 13:10:54 +0200 |
commit | e5a1ccdc5648669a45fd37781f99b022bdd1dd52 (patch) | |
tree | abc631f6077629220545c2c606b2beaad6ef0f68 /Lib/test/test_time.py | |
parent | 2b319199ff5ba48ce7ebf0816241623538f6923e (diff) | |
download | cpython-e5a1ccdc5648669a45fd37781f99b022bdd1dd52.tar.gz |
Issue #22117: Add a new _PyTime_FromSeconds() function
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r-- | Lib/test/test_time.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index a9f6fd87ed..0891834c15 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -731,6 +731,13 @@ class TestPytime(unittest.TestCase): @unittest.skipUnless(_testcapi is not None, 'need the _testcapi module') class TestPyTime_t(unittest.TestCase): + def test_FromSeconds(self): + from _testcapi import PyTime_FromSeconds + for seconds in (0, 3, -456, _testcapi.INT_MAX, _testcapi.INT_MIN): + with self.subTest(seconds=seconds): + self.assertEqual(PyTime_FromSeconds(seconds), + seconds * SEC_TO_NS) + def test_FromSecondsObject(self): from _testcapi import PyTime_FromSecondsObject |