mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #10278: Add an optional strict argument to time.steady(), False by default
This commit is contained in:
parent
ec919cc74d
commit
071eca3f5c
3 changed files with 57 additions and 18 deletions
|
@ -340,6 +340,16 @@ class TimeTestCase(unittest.TestCase):
|
|||
self.assertGreater(t2, t1)
|
||||
self.assertAlmostEqual(dt, 0.1, delta=0.2)
|
||||
|
||||
def test_steady_strict(self):
|
||||
try:
|
||||
t1 = time.steady(strict=True)
|
||||
except OSError as err:
|
||||
self.skipTest("the monotonic clock failed: %s" % err)
|
||||
except NotImplementedError:
|
||||
self.skipTest("no monotonic clock available")
|
||||
t2 = time.steady(strict=True)
|
||||
self.assertGreaterEqual(t2, t1)
|
||||
|
||||
def test_localtime_failure(self):
|
||||
# Issue #13847: check for localtime() failure
|
||||
invalid_time_t = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue