[Python-checkins] cpython (2.7): Fixed tests with Tcl/Tk <8.5 (closes #18964).

serhiy.storchaka python-checkins at python.org
Sun Sep 8 19:34:49 CEST 2013


http://hg.python.org/cpython/rev/a22cfd0bdc9a
changeset:   85627:a22cfd0bdc9a
branch:      2.7
parent:      85611:44ed0cd3dc6d
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Sep 08 20:32:56 2013 +0300
summary:
  Fixed tests with Tcl/Tk <8.5 (closes #18964).

files:
  Lib/test/test_tcl.py |  22 ++++++++++++++++++----
  1 files changed, 18 insertions(+), 4 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
@@ -13,6 +13,14 @@
 from Tkinter import Tcl
 from _tkinter import TclError
 
+tcl_version = _tkinter.TCL_VERSION.split('.')
+try:
+    for i in range(len(tcl_version)):
+        tcl_version[i] = int(tcl_version[i])
+except ValueError:
+    pass
+tcl_version = tuple(tcl_version)
+
 
 class TkinterTest(unittest.TestCase):
 
@@ -209,9 +217,12 @@
             (('a', 3.4), ('a', 3.4)),
             ((), ()),
             (call('list', 1, '2', (3.4,)), (1, '2', (3.4,))),
-            (call('dict', 'create', 1, u'\u20ac', '\xe2\x82\xac', (3.4,)),
-                    (1, u'\u20ac', u'\u20ac', (3.4,))),
         ]
+        if tcl_version >= (8, 5):
+            testcases += [
+                (call('dict', 'create', 1, u'\u20ac', '\xe2\x82\xac', (3.4,)),
+                        (1, u'\u20ac', u'\u20ac', (3.4,))),
+            ]
         for arg, res in testcases:
             self.assertEqual(splitlist(arg), res)
         self.assertRaises(TclError, splitlist, '{')
@@ -243,9 +254,12 @@
             (('a', (2, 3.4)), ('a', (2, 3.4))),
             ((), ()),
             (call('list', 1, '2', (3.4,)), (1, '2', (3.4,))),
-            (call('dict', 'create', 12, u'\u20ac', '\xe2\x82\xac', (3.4,)),
-                    (12, u'\u20ac', u'\u20ac', (3.4,))),
         ]
+        if tcl_version >= (8, 5):
+            testcases += [
+                (call('dict', 'create', 12, u'\u20ac', '\xe2\x82\xac', (3.4,)),
+                        (12, u'\u20ac', u'\u20ac', (3.4,))),
+            ]
         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