diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-06-30 06:20:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 06:20:28 (GMT) |
commit | 5bb5bbfca847524bab5f2368bdb48eedf5dba74f (patch) | |
tree | 7f7ba4d92c8cde6f61152b7168bb61afb41b7077 /Lib/test/test_tcl.py | |
parent | f874bd1f0630644f3e3faaa2d51e6749465c70bd (diff) | |
download | cpython-5bb5bbfca847524bab5f2368bdb48eedf5dba74f.zip cpython-5bb5bbfca847524bab5f2368bdb48eedf5dba74f.tar.gz cpython-5bb5bbfca847524bab5f2368bdb48eedf5dba74f.tar.bz2 |
bpo-33974: Fix passing special characters to ttk widgets. (GH-7986)
Fix passing lists and tuples of strings containing special characters
'"', '\\', '{', '}' and '\n' as options to tkinter.ttk widgets.
Diffstat (limited to 'Lib/test/test_tcl.py')
-rw-r--r-- | Lib/test/test_tcl.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index db99b75..80f1668 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -649,6 +649,43 @@ class TclTest(unittest.TestCase): expected = {'a': (1, 2, 3), 'something': 'foo', 'status': ''} self.assertEqual(splitdict(tcl, arg), expected) + def test_join(self): + join = tkinter._join + tcl = self.interp.tk + def unpack(s): + return tcl.call('lindex', s, 0) + def check(value): + self.assertEqual(unpack(join([value])), value) + self.assertEqual(unpack(join([value, 0])), value) + self.assertEqual(unpack(unpack(join([[value]]))), value) + self.assertEqual(unpack(unpack(join([[value, 0]]))), value) + self.assertEqual(unpack(unpack(join([[value], 0]))), value) + self.assertEqual(unpack(unpack(join([[value, 0], 0]))), value) + check('') + check('spam') + check('sp am') + check('sp\tam') + check('sp\nam') + check(' \t\n') + check('{spam}') + check('{sp am}') + check('"spam"') + check('"sp am"') + check('{"spam"}') + check('"{spam}"') + check('sp\\am') + check('"sp\\am"') + check('"{}" "{}"') + check('"\\') + check('"{') + check('"}') + check('\n\\') + check('\n{') + check('\n}') + check('\\\n') + check('{\n') + check('}\n') + def test_new_tcl_obj(self): self.assertRaises(TypeError, _tkinter.Tcl_Obj) |