]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-152263: Fix test_set_wide for locales with wide characters (GH-154583)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 24 Jul 2026 07:58:42 +0000 (10:58 +0300)
committerGitHub <noreply@github.com>
Fri, 24 Jul 2026 07:58:42 +0000 (07:58 +0000)
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 <noreply@anthropic.com>
Lib/test/test_curses.py

index 8aecb1e3a7a42d5b5982e11d907195cd78bcaf50..17837c0219f88ebd8825e748f824cec34dfee4f2 100644 (file)
@@ -3133,7 +3133,10 @@ class SLKTests(NewtermTestBase):
         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()