From baabe07411bd2ca7bcc9f7590d08ae51027f2f49 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 12 Jul 2026 09:57:36 +0300 Subject: [PATCH 1/2] [3.13] gh-128846: Fix test_configure_custom_copy for the aqua theme with Tk 9 Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_ttk/test_style.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py index 56d8a5931fdfa5..2e0a0384dd2ae2 100644 --- a/Lib/test/test_ttk/test_style.py +++ b/Lib/test/test_ttk/test_style.py @@ -161,9 +161,17 @@ def test_configure_custom_copy(self): newname = f'C.{name}' self.assertEqual(style.configure(newname), None) style.configure(newname, **default) - self.assertEqual(style.configure(newname), default) + # With Tk 9 and the aqua theme an empty option value is + # read back as an empty tuple rather than an empty string + # (see gh-128846); normalize before comparing. + def norm(value): + return '' if value == () else value + copy = style.configure(newname) + self.assertEqual({k: norm(v) for k, v in copy.items()}, + default) for key, value in default.items(): - self.assertEqual(style.configure(newname, key), value) + self.assertEqual(norm(style.configure(newname, key)), + value) def test_map_custom_copy(self): From d41c0e6274fecc36aa6ce9bf6b8a9a78c846c287 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 14 Jul 2026 16:07:20 +0300 Subject: [PATCH 2/2] gh-128846: Fix the normalization direction in test_configure_custom_copy Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_ttk/test_style.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py index 2e0a0384dd2ae2..d2506db9fb75ba 100644 --- a/Lib/test/test_ttk/test_style.py +++ b/Lib/test/test_ttk/test_style.py @@ -161,11 +161,12 @@ def test_configure_custom_copy(self): newname = f'C.{name}' self.assertEqual(style.configure(newname), None) style.configure(newname, **default) - # With Tk 9 and the aqua theme an empty option value is - # read back as an empty tuple rather than an empty string - # (see gh-128846); normalize before comparing. + # gh-128846: on 3.13 the aqua theme with Tk 9 reports an + # unset option as an empty tuple in the original style but + # as an empty string in the copy. Normalize the copy back + # to the empty tuple before comparing. def norm(value): - return '' if value == () else value + return () if value == '' else value copy = style.configure(newname) self.assertEqual({k: norm(v) for k, v in copy.items()}, default)