summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-30 21:23:38 (GMT)
committerGitHub <noreply@github.com>2024-05-30 21:23:38 (GMT)
commitbd0d97ce3497da35d17daa329c294f4cb87196ee (patch)
tree385aa79e165a2def32b943cad69272715dc8d916
parent207d1b032fdc7f8921de220c29807925d1afa99b (diff)
downloadcpython-bd0d97ce3497da35d17daa329c294f4cb87196ee.zip
cpython-bd0d97ce3497da35d17daa329c294f4cb87196ee.tar.gz
cpython-bd0d97ce3497da35d17daa329c294f4cb87196ee.tar.bz2
[3.12] gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322) (GH-119807)
(cherry picked from commit 9732ed5ca94cd8fe9ca2fc7ba5a42dfa2b7791ea) Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-rw-r--r--Lib/test/test_tkinter/test_widgets.py14
-rw-r--r--Lib/test/test_ttk/test_widgets.py17
2 files changed, 22 insertions, 9 deletions
diff --git a/Lib/test/test_tkinter/test_widgets.py b/Lib/test/test_tkinter/test_widgets.py
index d3f942d..24604b2 100644
--- a/Lib/test/test_tkinter/test_widgets.py
+++ b/Lib/test/test_tkinter/test_widgets.py
@@ -660,7 +660,9 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
widget = self.create()
self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'))
self.checkParam(widget, 'tabs', '10.2 20.7 1i 2i',
- expected=('10.2', '20.7', '1i', '2i'))
+ expected=(10.2, 20.7, '1i', '2i')
+ if get_tk_patchlevel(self.root) >= (8, 6, 14)
+ else ('10.2', '20.7', '1i', '2i'))
self.checkParam(widget, 'tabs', '2c left 4c 6c center',
expected=('2c', 'left', '4c', '6c', 'center'))
self.checkInvalidParam(widget, 'tabs', 'spam',
@@ -999,12 +1001,16 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
widget.itemconfigure()
with self.assertRaisesRegex(TclError, 'bad listbox index "red"'):
widget.itemconfigure('red')
+ if get_tk_patchlevel(self.root) >= (8, 6, 14):
+ prefix = ('background', '', '', '')
+ else:
+ prefix = ('background', 'background', 'Background', '')
self.assertEqual(widget.itemconfigure(0, 'background'),
- ('background', 'background', 'Background', '', 'red'))
+ (*prefix, 'red'))
self.assertEqual(widget.itemconfigure('end', 'background'),
- ('background', 'background', 'Background', '', 'violet'))
+ (*prefix, 'violet'))
self.assertEqual(widget.itemconfigure('@0,0', 'background'),
- ('background', 'background', 'Background', '', 'red'))
+ (*prefix, 'red'))
d = widget.itemconfigure(0)
self.assertIsInstance(d, dict)
diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py
index e3e440c..308bbba 100644
--- a/Lib/test/test_ttk/test_widgets.py
+++ b/Lib/test/test_ttk/test_widgets.py
@@ -27,13 +27,20 @@ class StandardTtkOptionsTests(StandardOptionsTests):
def test_configure_padding(self):
widget = self.create()
- self.checkParam(widget, 'padding', 0, expected=('0',))
- self.checkParam(widget, 'padding', 5, expected=('5',))
- self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
+ if get_tk_patchlevel(self.root) < (8, 6, 14):
+ def padding_conv(value):
+ self.assertIsInstance(value, tuple)
+ return tuple(map(str, value))
+ else:
+ padding_conv = None
+ self.checkParam(widget, 'padding', 0, expected=(0,), conv=padding_conv)
+ self.checkParam(widget, 'padding', 5, expected=(5,), conv=padding_conv)
+ self.checkParam(widget, 'padding', (5, 6),
+ expected=(5, 6), conv=padding_conv)
self.checkParam(widget, 'padding', (5, 6, 7),
- expected=('5', '6', '7'))
+ expected=(5, 6, 7), conv=padding_conv)
self.checkParam(widget, 'padding', (5, 6, 7, 8),
- expected=('5', '6', '7', '8'))
+ expected=(5, 6, 7, 8), conv=padding_conv)
self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
self.checkParam(widget, 'padding', (), expected='')