summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index eb73af51ac..4d57bfbf9a 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -3549,6 +3549,23 @@ class TestPEP519(unittest.TestCase):
self.assertRaises(ZeroDivisionError, self.fspath,
_PathLike(ZeroDivisionError()))
+
+class TimesTests(unittest.TestCase):
+ def test_times(self):
+ times = os.times()
+ self.assertIsInstance(times, os.times_result)
+
+ for field in ('user', 'system', 'children_user', 'children_system',
+ 'elapsed'):
+ value = getattr(times, field)
+ self.assertIsInstance(value, float)
+
+ if os.name == 'nt':
+ self.assertEqual(times.children_user, 0)
+ self.assertEqual(times.children_system, 0)
+ self.assertEqual(times.elapsed, 0)
+
+
# Only test if the C version is provided, otherwise TestPEP519 already tested
# the pure Python implementation.
if hasattr(os, "_fspath"):