summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-28 16:56:50 (GMT)
committerGitHub <noreply@github.com>2022-01-28 16:56:50 (GMT)
commit95b70e2ccfb295c77c3696bcb20c1513310efd1f (patch)
treedfb92d6d5365c7fee4cc042dc48d945b3b802161
parent20f53136679e260466a765de5befa3b9db396c9e (diff)
downloadcpython-95b70e2ccfb295c77c3696bcb20c1513310efd1f.zip
cpython-95b70e2ccfb295c77c3696bcb20c1513310efd1f.tar.gz
cpython-95b70e2ccfb295c77c3696bcb20c1513310efd1f.tar.bz2
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
(cherry picked from commit c27a33132be101e246ae2584f1826477357138d6) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/test/test_time.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index d89078f..7f76898 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -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)
-
- #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')