]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 28 Jan 2022 16:56:26 +0000 (08:56 -0800)
committerGitHub <noreply@github.com>
Fri, 28 Jan 2022 16:56:26 +0000 (08:56 -0800)
(cherry picked from commit c27a33132be101e246ae2584f1826477357138d6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Lib/test/test_time.py

index be9fb5ad5f0b178dfee93dfd2144193d893672fb..008ba2833a7d76f7af9306fc3beca9928d139ec7 100644 (file)
@@ -544,20 +544,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')