mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5.
This commit is contained in:
commit
9a3424b72e
1 changed files with 28 additions and 5 deletions
|
@ -21,6 +21,21 @@ except ValueError:
|
||||||
pass
|
pass
|
||||||
tcl_version = tuple(tcl_version)
|
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):
|
class TkinterTest(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -259,10 +274,14 @@ class TclTest(unittest.TestCase):
|
||||||
('1', '2', '3.4')),
|
('1', '2', '3.4')),
|
||||||
]
|
]
|
||||||
if tcl_version >= (8, 5):
|
if tcl_version >= (8, 5):
|
||||||
|
if not self.wantobjects or get_tk_patchlevel() < (8, 5, 5):
|
||||||
|
# Before 8.5.5 dicts were converted to lists through string
|
||||||
|
expected = ('12', '\u20ac', '\u20ac', '3.4')
|
||||||
|
else:
|
||||||
|
expected = (12, '\u20ac', '\u20ac', (3.4,))
|
||||||
testcases += [
|
testcases += [
|
||||||
(call('dict', 'create', 1, '\u20ac', b'\xe2\x82\xac', (3.4,)),
|
(call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)),
|
||||||
(1, '\u20ac', '\u20ac', (3.4,)) if self.wantobjects else
|
expected),
|
||||||
('1', '\u20ac', '\u20ac', '3.4')),
|
|
||||||
]
|
]
|
||||||
for arg, res in testcases:
|
for arg, res in testcases:
|
||||||
self.assertEqual(splitlist(arg), res, msg=arg)
|
self.assertEqual(splitlist(arg), res, msg=arg)
|
||||||
|
@ -299,10 +318,14 @@ class TclTest(unittest.TestCase):
|
||||||
('1', '2', '3.4')),
|
('1', '2', '3.4')),
|
||||||
]
|
]
|
||||||
if tcl_version >= (8, 5):
|
if tcl_version >= (8, 5):
|
||||||
|
if not self.wantobjects or get_tk_patchlevel() < (8, 5, 5):
|
||||||
|
# Before 8.5.5 dicts were converted to lists through string
|
||||||
|
expected = ('12', '\u20ac', '\u20ac', '3.4')
|
||||||
|
else:
|
||||||
|
expected = (12, '\u20ac', '\u20ac', (3.4,))
|
||||||
testcases += [
|
testcases += [
|
||||||
(call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)),
|
(call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)),
|
||||||
(12, '\u20ac', '\u20ac', (3.4,)) if self.wantobjects else
|
expected),
|
||||||
('12', '\u20ac', '\u20ac', '3.4')),
|
|
||||||
]
|
]
|
||||||
for arg, res in testcases:
|
for arg, res in testcases:
|
||||||
self.assertEqual(split(arg), res, msg=arg)
|
self.assertEqual(split(arg), res, msg=arg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue