Skip to content

Commit 95b70e2

Browse files
bpo-46530: add "thread_time" to test_time.test_get_clock_info (GH-30913)
(cherry picked from commit c27a331) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent 20f5313 commit 95b70e2

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Lib/test/test_time.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -545,20 +545,26 @@ def test_localtime_failure(self):
545545
self.assertRaises(ValueError, time.ctime, float("nan"))
546546

547547
def test_get_clock_info(self):
548-
clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
548+
clocks = [
549+
'monotonic',
550+
'perf_counter',
551+
'process_time',
552+
'time',
553+
'thread_time',
554+
]
549555

550556
for name in clocks:
551-
info = time.get_clock_info(name)
552-
553-
#self.assertIsInstance(info, dict)
554-
self.assertIsInstance(info.implementation, str)
555-
self.assertNotEqual(info.implementation, '')
556-
self.assertIsInstance(info.monotonic, bool)
557-
self.assertIsInstance(info.resolution, float)
558-
# 0.0 < resolution <= 1.0
559-
self.assertGreater(info.resolution, 0.0)
560-
self.assertLessEqual(info.resolution, 1.0)
561-
self.assertIsInstance(info.adjustable, bool)
557+
with self.subTest(name=name):
558+
info = time.get_clock_info(name)
559+
560+
self.assertIsInstance(info.implementation, str)
561+
self.assertNotEqual(info.implementation, '')
562+
self.assertIsInstance(info.monotonic, bool)
563+
self.assertIsInstance(info.resolution, float)
564+
# 0.0 < resolution <= 1.0
565+
self.assertGreater(info.resolution, 0.0)
566+
self.assertLessEqual(info.resolution, 1.0)
567+
self.assertIsInstance(info.adjustable, bool)
562568

563569
self.assertRaises(ValueError, time.get_clock_info, 'xxx')
564570

0 commit comments

Comments
 (0)