From 138f4c5bf41e686f80c4d97ce4bfb34c6a383fc9 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 12 Jul 2026 12:21:52 +0300 Subject: [PATCH] gh-153513: Remove obsolete Tk version guards in tkinter tests Since gh-153513, _tkinter returns int, float and pixel objects for the corresponding Tcl object types on all Tk versions. The tests for the Text "tabs" and ttk "padding" options therefore no longer need to expect string tuples on Tk older than 8.6.14. Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_tkinter/test_widgets.py | 4 +--- Lib/test/test_ttk/test_widgets.py | 16 +++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_tkinter/test_widgets.py b/Lib/test/test_tkinter/test_widgets.py index 98c78895e84932..f6f9332cb105e5 100644 --- a/Lib/test/test_tkinter/test_widgets.py +++ b/Lib/test/test_tkinter/test_widgets.py @@ -915,9 +915,7 @@ def test_configure_tabs(self): 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') - if get_tk_patchlevel(self.root) >= (8, 6, 14) - else ('10.2', '20.7', '1i', '2i')) + expected=(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', diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py index 36b8658656076d..dc23c52a884465 100644 --- a/Lib/test/test_ttk/test_widgets.py +++ b/Lib/test/test_ttk/test_widgets.py @@ -29,20 +29,14 @@ def test_configure_class(self): def test_configure_padding(self): widget = self.create() - 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', 0, expected=(0,)) + self.checkParam(widget, 'padding', 5, expected=(5,)) self.checkParam(widget, 'padding', (5, 6), - expected=(5, 6), conv=padding_conv) + expected=(5, 6)) self.checkParam(widget, 'padding', (5, 6, 7), - expected=(5, 6, 7), conv=padding_conv) + expected=(5, 6, 7)) self.checkParam(widget, 'padding', (5, 6, 7, 8), - expected=(5, 6, 7, 8), conv=padding_conv) + expected=(5, 6, 7, 8)) self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p')) self.checkParam(widget, 'padding', (), expected='')