Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10cbb1e

Browse files
Fixed new Tkinter tests added in issue #21522 with Tk 8.4.
1 parent 8447c70 commit 10cbb1e

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

Lib/tkinter/test/test_tkinter/test_widgets.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,12 +961,15 @@ def test_paneconfigure(self):
961961
self.assertEqual(v, p.paneconfigure(b, k))
962962
self.assertEqual(v[4], p.panecget(b, k))
963963

964-
def check_paneconfigure(self, p, b, name, value, expected):
965-
if not self.wantobjects:
964+
def check_paneconfigure(self, p, b, name, value, expected, stringify=False):
965+
conv = lambda x: x
966+
if not self.wantobjects or stringify:
966967
expected = str(expected)
968+
if self.wantobjects and stringify:
969+
conv = str
967970
p.paneconfigure(b, **{name: value})
968-
self.assertEqual(p.paneconfigure(b, name)[4], expected)
969-
self.assertEqual(p.panecget(b, name), expected)
971+
self.assertEqual(conv(p.paneconfigure(b, name)[4]), expected)
972+
self.assertEqual(conv(p.panecget(b, name)), expected)
970973

971974
def check_paneconfigure_bad(self, p, b, name, msg):
972975
with self.assertRaisesRegex(TclError, msg):
@@ -986,10 +989,12 @@ def test_paneconfigure_before(self):
986989

987990
def test_paneconfigure_height(self):
988991
p, b, c = self.create2()
989-
self.check_paneconfigure(p, b, 'height', 10, 10)
992+
self.check_paneconfigure(p, b, 'height', 10, 10,
993+
stringify=tcl_version < (8, 5))
990994
self.check_paneconfigure_bad(p, b, 'height',
991995
'bad screen distance "badValue"')
992996

997+
@requires_tcl(8, 5)
993998
def test_paneconfigure_hide(self):
994999
p, b, c = self.create2()
9951000
self.check_paneconfigure(p, b, 'hide', False, 0)
@@ -1022,6 +1027,7 @@ def test_paneconfigure_sticky(self):
10221027
'be a string containing zero or more of '
10231028
'n, e, s, and w')
10241029

1030+
@requires_tcl(8, 5)
10251031
def test_paneconfigure_stretch(self):
10261032
p, b, c = self.create2()
10271033
self.check_paneconfigure(p, b, 'stretch', 'alw', 'always')
@@ -1031,7 +1037,8 @@ def test_paneconfigure_stretch(self):
10311037

10321038
def test_paneconfigure_width(self):
10331039
p, b, c = self.create2()
1034-
self.check_paneconfigure(p, b, 'width', 10, 10)
1040+
self.check_paneconfigure(p, b, 'width', 10, 10,
1041+
stringify=tcl_version < (8, 5))
10351042
self.check_paneconfigure_bad(p, b, 'width',
10361043
'bad screen distance "badValue"')
10371044

0 commit comments

Comments
 (0)