https://github.com/python/cpython/commit/eef23498751fff48f15c70975b415161491621a3
commit: eef23498751fff48f15c70975b415161491621a3
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-24T07:58:42Z
summary:

gh-152263: Fix test_set_wide for locales with wide characters (GH-154583)

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 <[email protected]>

files:
M Lib/test/test_curses.py

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()

_______________________________________________
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