diff options
-rw-r--r-- | Lib/test/test_curses.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index ce09855ac5..21ac6089fc 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -267,11 +267,18 @@ def test_issue6243(stdscr): def test_unget_wch(stdscr): if not hasattr(curses, 'unget_wch'): return + import locale + encoding = locale.getpreferredencoding() for ch in ('a', '\xe9', '\u20ac', '\U0010FFFF'): try: + ch.encode(encoding) + except UnicodeEncodeError: + continue + try: curses.unget_wch(ch) except Exception as err: - raise Exception("unget_wch(%a) failed: %s" % (ch, err)) + raise Exception("unget_wch(%a) failed with locale encoding %s: %s" + % (ch, encoding, err)) read = stdscr.get_wch() read = chr(read) if read != ch: |