[Jython-checkins] jython: Add named tuples tests for previous commit

darjus.loktevic jython-checkins at python.org
Thu Nov 12 21:13:09 EST 2015


https://hg.python.org/jython/rev/e2ecaaa9ac97
changeset:   7802:e2ecaaa9ac97
user:        Darjus Loktevic <darjus at gmail.com>
date:        Fri Nov 13 13:13:02 2015 +1100
summary:
  Add named tuples tests for previous commit

files:
  Lib/test/test_posix.py  |   3 +++
  Lib/test/test_sys_jy.py |  10 ++++++++--
  Lib/test/test_time.py   |   4 ++++
  3 files changed, 15 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -217,6 +217,9 @@
         if hasattr(posix, 'stat'):
             self.assertTrue(posix.stat(test_support.TESTFN))
 
+    def test_stat_tuple(self):
+        self.assertEqual(tuple(posix.stat(".")), posix.stat("."))
+
     def _test_all_chown_common(self, chown_func, first_param):
         """Common code for chown, fchown and lchown tests."""
         if os.getuid() == 0:
diff --git a/Lib/test/test_sys_jy.py b/Lib/test/test_sys_jy.py
--- a/Lib/test/test_sys_jy.py
+++ b/Lib/test/test_sys_jy.py
@@ -69,14 +69,20 @@
         self.assert_(type(sys.getdefaultencoding) == type(gde))
 
     def test_get_tuple_from_version_info(self):
-        # sys.version_info is a tuple subclass
-        pass #self.assertEqual(type(tuple(sys.version_info)), tuple)
+        self.assertEqual(type(tuple(sys.version_info)), tuple)
+
+    def test_float_info_tuple(self):
+        self.assertEqual(tuple(sys.float_info), sys.float_info)
+
+    def test_long_info_tuple(self):
+        self.assertEqual(tuple(sys.long_info), sys.long_info)
 
     def test_version_info_gt_lt(self):
         self.assertTrue(sys.version_info > (0, 0))
         self.assertTrue(sys.version_info < (99, 99))
 
 
+
 def exec_code_separately(function, sharing=False):
     """Runs code in a separate context: (thread, PySystemState, PythonInterpreter)
 
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -234,6 +234,10 @@
         t1 = time.mktime(gt1)
         self.assertTrue(0 <= (t1-t0) < 0.2)
 
+    def test_gmtime_tmetuple(self):
+        t = time.gmtime()
+        self.assertEqual(tuple(t), t)
+
     def test_localtime_without_arg(self):
         lt0 = time.localtime()
         lt1 = time.localtime(None)

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list