[Python-checkins] cpython (2.7): Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5.

serhiy.storchaka python-checkins at python.org
Sun Feb 2 22:05:41 CET 2014


http://hg.python.org/cpython/rev/515e6afd2f0f
changeset:   88903:515e6afd2f0f
branch:      2.7
parent:      88900:767d034b3feb
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Feb 02 23:04:06 2014 +0200
summary:
  Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5.

files:
  Lib/test/test_tcl.py |  37 +++++++++++++++++++++++++++----
  1 files changed, 32 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -19,6 +19,21 @@
     pass
 tcl_version = tuple(tcl_version)
 
+_tk_patchlevel = None
+def get_tk_patchlevel():
+    global _tk_patchlevel
+    if _tk_patchlevel is None:
+        tcl = Tcl()
+        patchlevel = []
+        for x in tcl.call('info', 'patchlevel').split('.'):
+            try:
+                x = int(x, 10)
+            except ValueError:
+                x = -1
+            patchlevel.append(x)
+        _tk_patchlevel = tuple(patchlevel)
+    return _tk_patchlevel
+
 
 class TkinterTest(unittest.TestCase):
 
@@ -272,10 +287,16 @@
                 ('1', '2', '3.4')),
         ]
         if tcl_version >= (8, 5):
+            if not self.wantobjects:
+                expected = ('12', '\xe2\x82\xac', '\xe2\x82\xac', '3.4')
+            elif get_tk_patchlevel() < (8, 5, 5):
+                # Before 8.5.5 dicts were converted to lists through string
+                expected = ('12', u'\u20ac', u'\u20ac', '3.4')
+            else:
+                expected = (12, u'\u20ac', u'\u20ac', (3.4,))
             testcases += [
-                (call('dict', 'create', 1, u'\u20ac', '\xe2\x82\xac', (3.4,)),
-                    (1, u'\u20ac', u'\u20ac', (3.4,)) if self.wantobjects else
-                    ('1', '\xe2\x82\xac', '\xe2\x82\xac', '3.4')),
+                (call('dict', 'create', 12, u'\u20ac', '\xe2\x82\xac', (3.4,)),
+                    expected),
             ]
         for arg, res in testcases:
             self.assertEqual(splitlist(arg), res)
@@ -312,10 +333,16 @@
                 ('1', '2', '3.4')),
         ]
         if tcl_version >= (8, 5):
+            if not self.wantobjects:
+                expected = ('12', '\xe2\x82\xac', '\xe2\x82\xac', '3.4')
+            elif get_tk_patchlevel() < (8, 5, 5):
+                # Before 8.5.5 dicts were converted to lists through string
+                expected = ('12', u'\u20ac', u'\u20ac', '3.4')
+            else:
+                expected = (12, u'\u20ac', u'\u20ac', (3.4,))
             testcases += [
                 (call('dict', 'create', 12, u'\u20ac', '\xe2\x82\xac', (3.4,)),
-                    (12, u'\u20ac', u'\u20ac', (3.4,)) if self.wantobjects else
-                    ('12', '\xe2\x82\xac', '\xe2\x82\xac', '3.4')),
+                    expected),
             ]
         for arg, res in testcases:
             self.assertEqual(split(arg), res)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list