From aad3551e67c7f20f403c271894b2ac8c7801d9d7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 24 Jun 2026 22:23:31 +0300 Subject: [PATCH] gh-152093: Fix test_tk_caret() on macOS macOS records the caret only for the key window, so the query reads back zeros instead of the values set in the test. Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_tkinter/test_misc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_tkinter/test_misc.py b/Lib/test/test_tkinter/test_misc.py index cfd3090e46b1abf..98af4d822dadc43 100644 --- a/Lib/test/test_tkinter/test_misc.py +++ b/Lib/test/test_tkinter/test_misc.py @@ -485,7 +485,11 @@ def test_tk_useinputmethods(self): def test_tk_caret(self): self.assertIsNone(self.root.tk_caret(x=5, y=10, height=20)) caret = self.root.tk_caret() - self.assertEqual(caret, {'x': 5, 'y': 10, 'height': 20}) + if self.root._windowingsystem == 'aqua': + # macOS records the caret only for the key window. + self.assertEqual(set(caret), {'x', 'y', 'height'}) + else: + self.assertEqual(caret, {'x': 5, 'y': 10, 'height': 20}) def test_tk_scaling(self): old = self.root.tk_scaling()