diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-08-29 18:37:37 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-08-29 18:37:37 (GMT) |
commit | e752e20605f3fbcf9976187d3243b2fb01c7d8de (patch) | |
tree | 4546546706a2730b8504bf9f196bd49ec59dc4f1 /Lib/test/test_curses.py | |
parent | ff638ea6dbc7ff6819a083f9a9562a8099accade (diff) | |
download | cpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.zip cpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.tar.gz cpython-e752e20605f3fbcf9976187d3243b2fb01c7d8de.tar.bz2 |
Add simple unit test for ascii.unctrl() function
Diffstat (limited to 'Lib/test/test_curses.py')
-rw-r--r-- | Lib/test/test_curses.py | 13 |
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() |