summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-08-29 18:37:37 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2003-08-29 18:37:37 (GMT)
commite752e20605f3fbcf9976187d3243b2fb01c7d8de (patch)
tree4546546706a2730b8504bf9f196bd49ec59dc4f1 /Lib
parentff638ea6dbc7ff6819a083f9a9562a8099accade (diff)
downloadcpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.zip
cpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.tar.gz
cpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.tar.bz2
Add simple unit test for ascii.unctrl() function
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_curses.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index f62783f..e65adbf 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -194,6 +194,15 @@ def module_funcs(stdscr):
curses.mousemask(curses.BUTTON1_PRESSED)
curses.mouseinterval(10)
+def unit_tests():
+ from curses import ascii
+ for ch, expected in [('a', 'a'), ('A', 'A'),
+ (';', ';'), (' ', ' '),
+ ('\x7f', '^?'), ('\n', '^J'), ('\0', '^@')]:
+ if ascii.unctrl(ch) != expected:
+ print 'curses.unctrl fails on character', repr(ch)
+
+
def main(stdscr):
curses.savetty()
@@ -203,11 +212,15 @@ def main(stdscr):
finally:
curses.resetty()
+
if __name__ == '__main__':
curses.wrapper(main)
+ unit_tests()
else:
try:
stdscr = curses.initscr()
main(stdscr)
finally:
curses.endwin()
+
+ unit_tests()