https://github.com/python/cpython/commit/4197a796ecf3a751ad7245b8d4f980d6d444b614
commit: 4197a796ecf3a751ad7245b8d4f980d6d444b614
branch: main
author: Erlend E. Aasland <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-10-13T09:38:47+02:00
summary:

gh-86673: Loosen test_ttk.test_identify() requirements (#125335)

In aeca373b3 (PR gh-12011, issue gh-71500), test_identify() was changed to 
expect different results on Darwin. Ned's fix was later adjusted by e52f9bee8. 
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.

files:
M Lib/test/test_ttk/test_widgets.py

diff --git a/Lib/test/test_ttk/test_widgets.py 
b/Lib/test/test_ttk/test_widgets.py
index 88740b18864006..10bec33be617a1 100644
--- a/Lib/test/test_ttk/test_widgets.py
+++ b/Lib/test/test_ttk/test_widgets.py
@@ -336,7 +336,8 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
         'show', 'state', 'style', 'takefocus', 'textvariable',
         'validate', 'validatecommand', 'width', 'xscrollcommand',
     )
-    IDENTIFY_AS = 'Entry.field' if sys.platform == 'darwin' else 'textarea'
+    # bpo-27313: macOS Tk/Tcl may or may not report 'Entry.field'.
+    IDENTIFY_AS = {'Entry.field', 'textarea'}
 
     def setUp(self):
         super().setUp()
@@ -373,8 +374,7 @@ def test_identify(self):
         self.entry.pack()
         self.entry.update()
 
-        # bpo-27313: macOS Cocoa widget differs from X, allow either
-        self.assertEqual(self.entry.identify(5, 5), self.IDENTIFY_AS)
+        self.assertIn(self.entry.identify(5, 5), self.IDENTIFY_AS)
         self.assertEqual(self.entry.identify(-1, -1), "")
 
         self.assertRaises(tkinter.TclError, self.entry.identify, None, 5)
@@ -461,7 +461,7 @@ class ComboboxTest(EntryTest, unittest.TestCase):
         'validate', 'validatecommand', 'values',
         'width', 'xscrollcommand',
     )
-    IDENTIFY_AS = 'Combobox.button' if sys.platform == 'darwin' else 'textarea'
+    IDENTIFY_AS = {'Combobox.button', 'textarea'}
 
     def setUp(self):
         super().setUp()
@@ -1204,7 +1204,7 @@ class SpinboxTest(EntryTest, unittest.TestCase):
         'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
         'values', 'width', 'wrap', 'xscrollcommand',
     )
-    IDENTIFY_AS = 'Spinbox.field' if sys.platform == 'darwin' else 'textarea'
+    IDENTIFY_AS = {'Spinbox.field', 'textarea'}
 
     def setUp(self):
         super().setUp()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to