diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:24:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:24:07 (GMT) |
commit | 1317e1446805f1ab6b3299eef0a2910bab2887e0 (patch) | |
tree | 02398689ce556ce529283716ce425231995ec647 /Lib/tkinter | |
parent | fc055252ebab9a1ecdfc0d04bc9c11168c2db9f7 (diff) | |
download | cpython-1317e1446805f1ab6b3299eef0a2910bab2887e0.zip cpython-1317e1446805f1ab6b3299eef0a2910bab2887e0.tar.gz cpython-1317e1446805f1ab6b3299eef0a2910bab2887e0.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): |