summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_curses.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-28 23:40:57 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-08-28 23:40:57 (GMT)
commitca2b64682e2f3c5e3fb2ed150600a73105119e82 (patch)
tree69f5e40353c33dfbbfc79fb7c49cc1a1aaca3bcc /Lib/test/test_curses.py
parent3694401ad278040c6517095ecb2d50ee43b0d7fb (diff)
downloadcpython-ca2b64682e2f3c5e3fb2ed150600a73105119e82.zip
cpython-ca2b64682e2f3c5e3fb2ed150600a73105119e82.tar.gz
cpython-ca2b64682e2f3c5e3fb2ed150600a73105119e82.tar.bz2
Issue #15785: Modify window.get_wch() API of the curses module: return a
character for most keys, and an integer for special keys, instead of always returning an integer. So it is now possible to distinguish special keys like keypad keys.
Diffstat (limited to 'Lib/test/test_curses.py')
-rw-r--r--Lib/test/test_curses.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 21ac608..e959622 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -267,8 +267,7 @@ def test_issue6243(stdscr):
def test_unget_wch(stdscr):
if not hasattr(curses, 'unget_wch'):
return
- import locale
- encoding = locale.getpreferredencoding()
+ encoding = stdscr.encoding
for ch in ('a', '\xe9', '\u20ac', '\U0010FFFF'):
try:
ch.encode(encoding)
@@ -277,18 +276,17 @@ def test_unget_wch(stdscr):
try:
curses.unget_wch(ch)
except Exception as err:
- raise Exception("unget_wch(%a) failed with locale encoding %s: %s"
- % (ch, encoding, err))
+ raise Exception("unget_wch(%a) failed with encoding %s: %s"
+ % (ch, stdscr.encoding, err))
read = stdscr.get_wch()
- read = chr(read)
if read != ch:
raise AssertionError("%r != %r" % (read, ch))
code = ord(ch)
curses.unget_wch(code)
read = stdscr.get_wch()
- if read != code:
- raise AssertionError("%r != %r" % (read, code))
+ if read != ch:
+ raise AssertionError("%r != %r" % (read, ch))
def test_issue10570():
b = curses.tparm(curses.tigetstr("cup"), 5, 3)