Skip to content

Commit 9c629c8

Browse files
pythongh-86673: Loosen test_ttk.test_identify() requirements
In aeca373 (PR pythongh-12011, issue pythongh-71500), test_identify() was changed to expect different results on Darwin. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests.
1 parent 76b29d2 commit 9c629c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_ttk/test_widgets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
336336
'show', 'state', 'style', 'takefocus', 'textvariable',
337337
'validate', 'validatecommand', 'width', 'xscrollcommand',
338338
)
339-
IDENTIFY_AS = 'Entry.field' if sys.platform == 'darwin' else 'textarea'
339+
# bpo-27313: macOS Tk/Tcl may or may not report 'Entry.field'.
340+
IDENTIFY_AS = {'Entry.field', 'textarea'}
340341

341342
def setUp(self):
342343
super().setUp()
@@ -373,8 +374,7 @@ def test_identify(self):
373374
self.entry.pack()
374375
self.entry.update()
375376

376-
# bpo-27313: macOS Cocoa widget differs from X, allow either
377-
self.assertEqual(self.entry.identify(5, 5), self.IDENTIFY_AS)
377+
self.assertIn(self.entry.identify(5, 5), self.IDENTIFY_AS)
378378
self.assertEqual(self.entry.identify(-1, -1), "")
379379

380380
self.assertRaises(tkinter.TclError, self.entry.identify, None, 5)
@@ -461,7 +461,7 @@ class ComboboxTest(EntryTest, unittest.TestCase):
461461
'validate', 'validatecommand', 'values',
462462
'width', 'xscrollcommand',
463463
)
464-
IDENTIFY_AS = 'Combobox.button' if sys.platform == 'darwin' else 'textarea'
464+
IDENTIFY_AS = {'Combobox.button', 'textarea'}
465465

466466
def setUp(self):
467467
super().setUp()
@@ -1204,7 +1204,7 @@ class SpinboxTest(EntryTest, unittest.TestCase):
12041204
'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
12051205
'values', 'width', 'wrap', 'xscrollcommand',
12061206
)
1207-
IDENTIFY_AS = 'Spinbox.field' if sys.platform == 'darwin' else 'textarea'
1207+
IDENTIFY_AS = {'Spinbox.field', 'textarea'}
12081208

12091209
def setUp(self):
12101210
super().setUp()

0 commit comments

Comments
 (0)