diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:25:56 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:25:56 (GMT) |
commit | ce591c2868385748ef13f636f8d50309e007a809 (patch) | |
tree | 831a05ac504aa154cc1d4cb6674968603b3ca7e8 /Lib/tkinter | |
parent | 1b7c931e0bd391210e11f5a1311e55ce64b3d4e6 (diff) | |
parent | 1317e1446805f1ab6b3299eef0a2910bab2887e0 (diff) | |
download | cpython-ce591c2868385748ef13f636f8d50309e007a809.zip cpython-ce591c2868385748ef13f636f8d50309e007a809.tar.gz cpython-ce591c2868385748ef13f636f8d50309e007a809.tar.bz2 |
Issue #20368: The null character now correctly passed from Tcl to Python.
Improved error handling in variables-related commands.
Diffstat (limited to 'Lib/tkinter')
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_variables.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py index fa1f898..9d910ac 100644 --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -68,6 +68,18 @@ class TestVariable(TestBase): with self.assertRaises(TypeError): Variable(self.root, name=123) + def test_null_in_name(self): + with self.assertRaises(ValueError): + Variable(self.root, name='var\x00name') + with self.assertRaises(ValueError): + self.root.globalsetvar('var\x00name', "value") + with self.assertRaises(ValueError): + self.root.globalsetvar(b'var\x00name', "value") + with self.assertRaises(ValueError): + self.root.setvar('var\x00name', "value") + with self.assertRaises(ValueError): + self.root.setvar(b'var\x00name', "value") + def test_initialize(self): v = Var() self.assertFalse(v.side_effect) @@ -87,6 +99,12 @@ class TestStringVar(TestBase): self.root.globalsetvar("name", "value") self.assertEqual("value", v.get()) + def test_get_null(self): + v = StringVar(self.root, "abc\x00def", "name") + self.assertEqual("abc\x00def", v.get()) + self.root.globalsetvar("name", "val\x00ue") + self.assertEqual("val\x00ue", v.get()) + class TestIntVar(TestBase): |