FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-133031: Fix test_textbox_edit_wide on a narrow build by serhiy-storchaka · Pull Request #152592 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
20 changes: 12 additions & 8 deletions Lib/test/test_curses.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2366,15 +2366,19 @@ def test_textbox_combining(self):
self.assertEqual(box.gather(), text + ' ')

def test_textbox_edit_wide(self):
# edit() reads characters through get_wch(). Each is used only if
# encodable in the current locale.
# edit() reads characters through get_wch(). Each character is pushed
# with unget_wch(), which on a narrow build requires it to encode to a
# single byte, so a non-ASCII case needs a wide build or an 8-bit locale.
for ch in ['A', 'é', '¤', '€', 'д']:
if self._encodable(ch):
with self.subTest(ch=ch):
box, win = self._make_textbox(1, 10)
for c in reversed(['a', ch, chr(curses.ascii.BEL)]):
curses.unget_wch(c)
self.assertEqual(box.edit(), 'a' + ch + ' ')
if not self._encodable(ch):
continue
if not WIDE_BUILD and len(ch.encode(self.stdscr.encoding)) != 1:
continue
with self.subTest(ch=ch):
box, win = self._make_textbox(1, 10)
for c in reversed(['a', ch, chr(curses.ascii.BEL)]):
curses.unget_wch(c)
self.assertEqual(box.edit(), 'a' + ch + ' ')

def test_textbox_movement(self):
box, win = self._make_textbox(3, 10)
Expand Down
Loading

Back | FazBrowse Home | New Git URL