From: Serhiy Storchaka Date: Sun, 8 Sep 2013 17:32:56 +0000 (+0300) Subject: Fixed tests with Tcl/Tk <8.5 (closes #18964). X-Git-Tag: v2.7.6rc1~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9402533cb1f83f9dbccf05a34f80eb6e7cee3c97;p=thirdparty%2FPython%2Fcpython.git Fixed tests with Tcl/Tk <8.5 (closes #18964). --- diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index 1e60b1d1a8da..50e1ac40acf9 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -13,6 +13,14 @@ _tkinter = test_support.import_module('_tkinter') 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 @@ class TclTest(unittest.TestCase): (('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 @@ class TclTest(unittest.TestCase): (('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)