summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/test_tkinter/test_variables.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter/test/test_tkinter/test_variables.py')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_variables.py18
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):