Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k-get_clock_info Changeset: r84793:132af9b56ede Date: 2016-05-28 00:41 -0700 http://bitbucket.org/pypy/pypy/changeset/132af9b56ede/
Log: bring over test_time's test diff --git a/pypy/module/time/test/test_time.py b/pypy/module/time/test/test_time.py --- a/pypy/module/time/test/test_time.py +++ b/pypy/module/time/test/test_time.py @@ -380,27 +380,17 @@ # process_time() should not include time spent during sleep assert (t2 - t1) < 0.05 - def test_get_clock_info_monotonic(self): + def test_get_clock_info(self): import time - clock_info = time.get_clock_info("monotonic") - assert clock_info.monotonic - assert not clock_info.adjustable - # Not really sure what to test about this - # At least this tests that the attr exists... - assert clock_info.resolution > 0 - - def test_get_clock_info_clock(self): - import time - clock_info = time.get_clock_info("clock") - assert clock_info.monotonic - assert not clock_info.adjustable - # Not really sure what to test about this - # At least this tests that the attr exists... - assert clock_info.resolution > 0 - - def test_get_clock_info_process_time(self): - import time - clock_info = time.get_clock_info("process_time") - assert clock_info.monotonic - assert not clock_info.adjustable - assert clock_info.resolution > 0 + clocks = ['clock', 'perf_counter', 'process_time', 'time'] + if hasattr(time, 'monotonic'): + clocks.append('monotonic') + for name in clocks: + info = time.get_clock_info(name) + assert isinstance(info.implementation, str) + assert info.implementation != '' + assert isinstance(info.monotonic, bool) + assert isinstance(info.resolution, float) + assert info.resolution > 0.0 + assert info.resolution <= 1.0 + assert isinstance(info.adjustable, bool) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit