Issue #10278: Add an optional strict argument to time.steady(), False by default

This commit is contained in:
Victor Stinner 2012-03-15 01:17:09 +01:00
parent ec919cc74d
commit 071eca3f5c
3 changed files with 57 additions and 18 deletions

View file

@ -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