mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-46530: add "thread_time" to test_time.test_get_clock_info (GH-30913)
(cherry picked from commit c27a33132b)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
20f5313667
commit
95b70e2ccf
1 changed files with 17 additions and 11 deletions
|
|
@ -545,20 +545,26 @@ class TimeTestCase(unittest.TestCase):
|
|||
self.assertRaises(ValueError, time.ctime, float("nan"))
|
||||
|
||||
def test_get_clock_info(self):
|
||||
clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
|
||||
clocks = [
|
||||
'monotonic',
|
||||
'perf_counter',
|
||||
'process_time',
|
||||
'time',
|
||||
'thread_time',
|
||||
]
|
||||
|
||||
for name in clocks:
|
||||
info = time.get_clock_info(name)
|
||||
with self.subTest(name=name):
|
||||
info = time.get_clock_info(name)
|
||||
|
||||
#self.assertIsInstance(info, dict)
|
||||
self.assertIsInstance(info.implementation, str)
|
||||
self.assertNotEqual(info.implementation, '')
|
||||
self.assertIsInstance(info.monotonic, bool)
|
||||
self.assertIsInstance(info.resolution, float)
|
||||
# 0.0 < resolution <= 1.0
|
||||
self.assertGreater(info.resolution, 0.0)
|
||||
self.assertLessEqual(info.resolution, 1.0)
|
||||
self.assertIsInstance(info.adjustable, bool)
|
||||
self.assertIsInstance(info.implementation, str)
|
||||
self.assertNotEqual(info.implementation, '')
|
||||
self.assertIsInstance(info.monotonic, bool)
|
||||
self.assertIsInstance(info.resolution, float)
|
||||
# 0.0 < resolution <= 1.0
|
||||
self.assertGreater(info.resolution, 0.0)
|
||||
self.assertLessEqual(info.resolution, 1.0)
|
||||
self.assertIsInstance(info.adjustable, bool)
|
||||
|
||||
self.assertRaises(ValueError, time.get_clock_info, 'xxx')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue