summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-01-28 05:43:00 (GMT)
committerGitHub <noreply@github.com>2022-01-28 05:43:00 (GMT)
commitc27a33132be101e246ae2584f1826477357138d6 (patch)
tree8f9066b840698c8b3418c943e00c42d796dfd5e2
parentf10dafc430279b4e6cf5b981ae3d1d76e8f431ad (diff)
downloadcpython-c27a33132be101e246ae2584f1826477357138d6.zip
cpython-c27a33132be101e246ae2584f1826477357138d6.tar.gz
cpython-c27a33132be101e246ae2584f1826477357138d6.tar.bz2
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)
-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 1c444e3..e3d75da 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -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')