mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #10278: Be more explicit in tests than wallclock() is monotonic (cannot
go backward)
This commit is contained in:
parent
d25cfe66f5
commit
2dd254d17a
1 changed files with 9 additions and 4 deletions
|
@ -332,11 +332,16 @@ class TimeTestCase(unittest.TestCase):
|
||||||
self.assertEqual(time.strftime('%Z', tt), tzname)
|
self.assertEqual(time.strftime('%Z', tt), tzname)
|
||||||
|
|
||||||
def test_wallclock(self):
|
def test_wallclock(self):
|
||||||
t0 = time.wallclock()
|
|
||||||
time.sleep(0.1)
|
|
||||||
t1 = time.wallclock()
|
t1 = time.wallclock()
|
||||||
t = t1 - t0
|
t2 = time.wallclock()
|
||||||
self.assertAlmostEqual(t, 0.1, delta=0.2)
|
self.assertGreater(t2, t1)
|
||||||
|
|
||||||
|
t1 = time.wallclock()
|
||||||
|
time.sleep(0.1)
|
||||||
|
t2 = time.wallclock()
|
||||||
|
self.assertGreater(t2, t1)
|
||||||
|
dt = t2 - t1
|
||||||
|
self.assertAlmostEqual(dt, 0.1, delta=0.2)
|
||||||
|
|
||||||
|
|
||||||
class TestLocale(unittest.TestCase):
|
class TestLocale(unittest.TestCase):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue