Skip to content

Commit c27a331

Browse files
authored
bpo-46530: add "thread_time" to test_time.test_get_clock_info (#30913)
1 parent f10dafc commit c27a331

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Lib/test/test_time.py

+18-12
Original file line numberDiff line numberDiff line change
@@ -556,20 +556,26 @@ def test_localtime_failure(self):
556556
self.assertRaises(ValueError, time.ctime, float("nan"))
557557

558558
def test_get_clock_info(self):
559-
clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
559+
clocks = [
560+
'monotonic',
561+
'perf_counter',
562+
'process_time',
563+
'time',
564+
'thread_time',
565+
]
560566

561567
for name in clocks:
562-
info = time.get_clock_info(name)
563-
564-
#self.assertIsInstance(info, dict)
565-
self.assertIsInstance(info.implementation, str)
566-
self.assertNotEqual(info.implementation, '')
567-
self.assertIsInstance(info.monotonic, bool)
568-
self.assertIsInstance(info.resolution, float)
569-
# 0.0 < resolution <= 1.0
570-
self.assertGreater(info.resolution, 0.0)
571-
self.assertLessEqual(info.resolution, 1.0)
572-
self.assertIsInstance(info.adjustable, bool)
568+
with self.subTest(name=name):
569+
info = time.get_clock_info(name)
570+
571+
self.assertIsInstance(info.implementation, str)
572+
self.assertNotEqual(info.implementation, '')
573+
self.assertIsInstance(info.monotonic, bool)
574+
self.assertIsInstance(info.resolution, float)
575+
# 0.0 < resolution <= 1.0
576+
self.assertGreater(info.resolution, 0.0)
577+
self.assertLessEqual(info.resolution, 1.0)
578+
self.assertIsInstance(info.adjustable, bool)
573579

574580
self.assertRaises(ValueError, time.get_clock_info, 'xxx')
575581

0 commit comments

Comments
 (0)