[Python-checkins] bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)
gvanrossum
webhook-mailer at python.org
Fri Jan 28 00:43:04 EST 2022
https://github.com/python/cpython/commit/c27a33132be101e246ae2584f1826477357138d6
commit: c27a33132be101e246ae2584f1826477357138d6
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2022-01-27T21:43:00-08:00
summary:
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)
files:
M Lib/test/test_time.py
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 1c444e381a552..e3d75da55cb3a 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -556,20 +556,26 @@ def test_localtime_failure(self):
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)
-
- #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)
+ with self.subTest(name=name):
+ info = time.get_clock_info(name)
+
+ 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')
More information about the Python-checkins
mailing list