8000 bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH… · python/cpython@ce5c637 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce5c637

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 8cd8246 commit ce5c637

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
@@ -544,20 +544,26 @@ def test_localtime_failure(self):
544544
self.assertRaises(ValueError, time.ctime, float("nan"))
545545

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

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

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

0 commit comments

Comments
 (0)
0