From 75b0b983b59add1ae9ad98efe9ae5385c466e403 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 24 Jul 2026 10:22:42 +0300 Subject: [PATCH] gh-152263: Fix test_set_wide for locales with wide characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The soft label can be truncated to fit the soft label width, e.g. in the EUC-JP locale, where "Å" and "ö" are double-width JIS X 0212 characters. Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_curses.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index 8aecb1e3a7a42d..17837c0219f88e 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -3133,7 +3133,10 @@ def test_set_wide(self): except UnicodeEncodeError: self.skipTest('the locale cannot encode %r' % label) curses.slk_set(1, label, 0) - self.assertEqual(curses.slk_label(1), label) + # The label can be truncated to fit the soft label width, e.g. in the + # EUC-JP locale, where "Å" and "ö" are double-width JIS X 0212 + # characters, so the 8-column label only fits "Ångstr". + self.assertIn(curses.slk_label(1), (label, 'Ångstr')) def test_set_bad_justify(self): self.make_slk_screen()