From baabe07411bd2ca7bcc9f7590d08ae51027f2f49 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 12 Jul 2026 09:57:36 +0300 Subject: [PATCH 1/3] [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 56d8a5931fdfa5c..2e0a0384dd2ae27 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/3] 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 2e0a0384dd2ae27..d2506db9fb75bad 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) From 5e4370934fc34af7a4b9bebed354c06e576027ef Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 15 Jul 2026 17:17:09 +0300 Subject: [PATCH 3/3] gh-128846: Normalize the default in test_configure_custom_copy On the aqua theme with Tk 9 the native style reports an unset option as an empty tuple, while a copied (non-native) style reports it as an empty string. The comparison of the copy against the default therefore has to normalize the empty tuple in the default. An earlier one-sided normalization of the copy regressed the CI, which links Tk 8.6, where the native style already reports an empty string. Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_ttk/test_style.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py index d2506db9fb75bad..41f3c2a9b94ed44 100644 --- a/Lib/test/test_ttk/test_style.py +++ b/Lib/test/test_ttk/test_style.py @@ -161,18 +161,16 @@ def test_configure_custom_copy(self): newname = f'C.{name}' self.assertEqual(style.configure(newname), None) style.configure(newname, **default) - # 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. + # gh-128846: the aqua theme with Tk 9 reports an unset + # option as an empty tuple, while the copy reports it as an + # empty string. def norm(value): - return () if value == '' else value - copy = style.configure(newname) - self.assertEqual({k: norm(v) for k, v in copy.items()}, - default) + return '' if value == () else value + self.assertEqual(style.configure(newname), + {k: norm(v) for k, v in default.items()}) for key, value in default.items(): - self.assertEqual(norm(style.configure(newname, key)), - value) + self.assertEqual(style.configure(newname, key), + norm(value)) def test_map_custom_copy(self):