Skip to content

Commit 5e43709

Browse files
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 <noreply@anthropic.com>
1 parent d41c0e6 commit 5e43709

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

Lib/test/test_ttk/test_style.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,16 @@ def test_configure_custom_copy(self):
161161
newname = f'C.{name}'
162162
self.assertEqual(style.configure(newname), None)
163163
style.configure(newname, **default)
164-
# gh-128846: on 3.13 the aqua theme with Tk 9 reports an
165-
# unset option as an empty tuple in the original style but
166-
# as an empty string in the copy. Normalize the copy back
167-
# to the empty tuple before comparing.
164+
# gh-128846: the aqua theme with Tk 9 reports an unset
165+
# option as an empty tuple, while the copy reports it as an
166+
# empty string.
168167
def norm(value):
169-
return () if value == '' else value
170-
copy = style.configure(newname)
171-
self.assertEqual({k: norm(v) for k, v in copy.items()},
172-
default)
168+
return '' if value == () else value
169+
self.assertEqual(style.configure(newname),
170+
{k: norm(v) for k, v in default.items()})
173171
for key, value in default.items():
174-
self.assertEqual(norm(style.configure(newname, key)),
175-
value)
172+
self.assertEqual(style.configure(newname, key),
173+
norm(value))
176174

177175

178176
def test_map_custom_copy(self):

0 commit comments

Comments
 (0)