From 832bc0b0ea20c2fade5d764e084a2caa09f09dd6 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 12 Jul 2026 18:27:10 +0300 Subject: [PATCH] gh-153513: Remove obsolete Tk version guards in tkinter tests (GH-153615) 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 98c78895e849..f6f9332cb105 100644 --- a/Lib/test/test_tkinter/test_widgets.py +++ b/Lib/test/test_tkinter/test_widgets.py @@ -915,9 +915,7 @@ 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') - 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 36b865865607..dc23c52a8844 100644 --- a/Lib/test/test_ttk/test_widgets.py +++ b/Lib/test/test_ttk/test_widgets.py @@ -29,20 +29,14 @@ class StandardTtkOptionsTests(StandardOptionsTests): 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='') -- 2.47.3