diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-10-20 14:30:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 14:30:57 (GMT) |
commit | b8dbb3a7f96718dddb8bed31130f421316213dc5 (patch) | |
tree | 3f012f56677d6a2ddc7c0c5009874f0c6db1da5e /Lib/tkinter/test | |
parent | c15ba304f35362470e29ea5626fed28366bc9571 (diff) | |
download | cpython-b8dbb3a7f96718dddb8bed31130f421316213dc5.zip cpython-b8dbb3a7f96718dddb8bed31130f421316213dc5.tar.gz cpython-b8dbb3a7f96718dddb8bed31130f421316213dc5.tar.bz2 |
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077) (GH-29080)
Since v8.6.11, a few configuration options seem to accept an empty value
where they did not previously; particularly the `type` of a `Menu`
widget, and the `compound` of any ttk widget with a label. Providing an
explicit expected error message to `checkEnumParam` bypasses the check
of an empty value, which no longer raises `TclError`.
(cherry picked from commit 4fe454c6f54b0948af67b53af6c2f35af6377e69)
Co-authored-by: Zachary Ware <zach@python.org>
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_widgets.py | 7 | ||||
-rw-r--r-- | Lib/tkinter/test/test_ttk/test_widgets.py | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index 39334de..cc227e5 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -1241,8 +1241,11 @@ class MenuTest(AbstractWidgetTest, unittest.TestCase): def test_configure_type(self): widget = self.create() - self.checkEnumParam(widget, 'type', - 'normal', 'tearoff', 'menubar') + self.checkEnumParam( + widget, 'type', + 'normal', 'tearoff', 'menubar', + errmsg='bad type "{}": must be normal, tearoff, or menubar', + ) def test_entryconfigure(self): m1 = self.create() diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py index a2a4de2..904aed0 100644 --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -169,10 +169,13 @@ class AbstractLabelTest(AbstractWidgetTest): errmsg='image "spam" doesn\'t exist') def test_configure_compound(self): + options = 'none text image center top bottom left right'.split() + errmsg = ( + 'bad compound "{}": must be' + f' {", ".join(options[:-1])}, or {options[-1]}' + ) widget = self.create() - self.checkEnumParam(widget, 'compound', - 'none', 'text', 'image', 'center', - 'top', 'bottom', 'left', 'right') + self.checkEnumParam(widget, 'compound', *options, errmsg=errmsg) def test_configure_state(self): widget = self.create() |