changeset: 90808:c7ee46ed2d70 branch: 2.7 parent: 90800:a7082e2898aa user: Serhiy Storchaka date: Fri May 23 23:57:46 2014 +0300 files: Lib/lib-tk/test/test_tkinter/test_widgets.py description: Fixed new Tkinter tests added in issue #21522 with Tk 8.4. diff -r a7082e2898aa -r c7ee46ed2d70 Lib/lib-tk/test/test_tkinter/test_widgets.py --- a/Lib/lib-tk/test/test_tkinter/test_widgets.py Fri May 23 14:08:31 2014 +0300 +++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py Fri May 23 23:57:46 2014 +0300 @@ -958,12 +958,15 @@ self.assertEqual(v, p.paneconfigure(b, k)) self.assertEqual(v[4], p.panecget(b, k)) - def check_paneconfigure(self, p, b, name, value, expected): - if not self.wantobjects: + def check_paneconfigure(self, p, b, name, value, expected, stringify=False): + conv = lambda x: x + if not self.wantobjects or stringify: expected = str(expected) + if self.wantobjects and stringify: + conv = str p.paneconfigure(b, **{name: value}) - self.assertEqual(p.paneconfigure(b, name)[4], expected) - self.assertEqual(p.panecget(b, name), expected) + self.assertEqual(conv(p.paneconfigure(b, name)[4]), expected) + self.assertEqual(conv(p.panecget(b, name)), expected) def check_paneconfigure_bad(self, p, b, name, msg): with self.assertRaisesRegexp(TclError, msg): @@ -983,10 +986,12 @@ def test_paneconfigure_height(self): p, b, c = self.create2() - self.check_paneconfigure(p, b, 'height', 10, 10) + self.check_paneconfigure(p, b, 'height', 10, 10, + stringify=tcl_version < (8, 5)) self.check_paneconfigure_bad(p, b, 'height', 'bad screen distance "badValue"') + @requires_tcl(8, 5) def test_paneconfigure_hide(self): p, b, c = self.create2() self.check_paneconfigure(p, b, 'hide', False, 0) @@ -1019,6 +1024,7 @@ 'be a string containing zero or more of ' 'n, e, s, and w') + @requires_tcl(8, 5) def test_paneconfigure_stretch(self): p, b, c = self.create2() self.check_paneconfigure(p, b, 'stretch', 'alw', 'always') @@ -1028,7 +1034,8 @@ def test_paneconfigure_width(self): p, b, c = self.create2() - self.check_paneconfigure(p, b, 'width', 10, 10) + self.check_paneconfigure(p, b, 'width', 10, 10, + stringify=tcl_version < (8, 5)) self.check_paneconfigure_bad(p, b, 'width', 'bad screen distance "badValue"')