[pypy-commit] pypy py3.5: Improve test for posix.times()

thisch pypy.commits at gmail.com
Wed Nov 15 10:17:34 EST 2017


Author: Thomas Hisch <t.hisch at gmail.com>
Branch: py3.5
Changeset: r93041:898194d1902c
Date: 2017-11-13 23:44 +0100
http://bitbucket.org/pypy/pypy/changeset/898194d1902c/

Log:	Improve test for posix.times()

	Test that posix.times() returns a times_result object.

diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -378,16 +378,21 @@
 
     def test_times(self):
         """
-        posix.times() should return a five-tuple giving float-representations
-        (seconds, effectively) of the four fields from the underlying struct
-        tms and the return value.
+        posix.times() should return a posix.times_result object giving 
+        float-representations (seconds, effectively) of the four fields from 
+        the underlying struct tms and the return value.
         """
         result = self.posix.times()
-        assert isinstance(result, tuple)
+        assert isinstance(self.posix.times(), self.posix.times_result)
+        assert isinstance(self.posix.times(), tuple)
         assert len(result) == 5
         for value in result:
             assert isinstance(value, float)
-
+        assert isinstance(result.user, float)
+        assert isinstance(result.system, float)
+        assert isinstance(result.children_user, float)
+        assert isinstance(result.children_system, float)
+        assert isinstance(result.elapsed, float)
 
     def test_strerror(self):
         assert isinstance(self.posix.strerror(0), str)


More information about the pypy-commit mailing list