]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)
authorNikita Sobolev <mail@sobolevn.me>
Fri, 28 Jan 2022 05:43:00 +0000 (08:43 +0300)
committerGitHub <noreply@github.com>
Fri, 28 Jan 2022 05:43:00 +0000 (21:43 -0800)
Lib/test/test_time.py

index 1c444e381a5528baf355eff89d4e5396f0231430..e3d75da55cb3a610eb03455d0d0c68be7dfcee08 100644 (file)
@@ -556,20 +556,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')