diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:23:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-03 19:23:46 (GMT) |
commit | ccffb25c5496b00cbe519e6d0e1038f61cdec563 (patch) | |
tree | 8781afe2dc7a2377c9bef6d7c0b04baefd7a8a66 /Lib/lib-tk/test | |
parent | da0dbc004ca9867db7dc470765505ebb09b949b0 (diff) | |
download | cpython-ccffb25c5496b00cbe519e6d0e1038f61cdec563.zip cpython-ccffb25c5496b00cbe519e6d0e1038f61cdec563.tar.gz cpython-ccffb25c5496b00cbe519e6d0e1038f61cdec563.tar.bz2 |
Issue #20368: The null character now correctly passed from Tcl to Python (in
unicode strings only). Improved error handling in variables-related commands.
Diffstat (limited to 'Lib/lib-tk/test')
-rw-r--r-- | Lib/lib-tk/test/test_tkinter/test_variables.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/lib-tk/test/test_tkinter/test_variables.py b/Lib/lib-tk/test/test_tkinter/test_variables.py index fe64ed2..a24ea38 100644 --- a/Lib/lib-tk/test/test_tkinter/test_variables.py +++ b/Lib/lib-tk/test/test_tkinter/test_variables.py @@ -58,6 +58,14 @@ 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.setvar('var\x00name', "value") + class TestStringVar(TestBase): @@ -71,6 +79,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): |