summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-05-04 11:45:57 (GMT)
committerLarry Hastings <larry@hastings.org>2014-05-04 11:45:57 (GMT)
commitf19a40071479eef0c8c65cb900d2cecbe00a72f1 (patch)
treeb19b4d4ce62932b41381f90602364ff21254c449 /Lib/test
parent53d2c41f77ab7658a1380bc304946b4920e5b49b (diff)
parent9147a9697ac60a9fff739394056992a61d207a16 (diff)
downloadcpython-f19a40071479eef0c8c65cb900d2cecbe00a72f1.zip
cpython-f19a40071479eef0c8c65cb900d2cecbe00a72f1.tar.gz
cpython-f19a40071479eef0c8c65cb900d2cecbe00a72f1.tar.bz2
Issue #21088: Merge from 3.4.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_curses.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index ce8f254..ad10f62 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -17,6 +17,7 @@ import sys, tempfile, os
import unittest
from test.support import requires, import_module
+import inspect
requires('curses')
# If either of these don't exist, skip the tests.
@@ -331,6 +332,34 @@ def test_encoding(stdscr):
else:
raise AssertionError("TypeError not raised")
+def test_issue21088(stdscr):
+ #
+ # http://bugs.python.org/issue21088
+ #
+ # the bug:
+ # when converting curses.window.addch to Argument Clinic
+ # the first two parameters were switched.
+
+ # if someday we can represent the signature of addch
+ # we will need to rewrite this test.
+ try:
+ signature = inspect.signature(stdscr.addch)
+ self.assertFalse(signature)
+ except ValueError:
+ # not generating a signature is fine.
+ pass
+
+ # So. No signature for addch.
+ # But Argument Clinic gave us a human-readable equivalent
+ # as the first line of the docstring. So we parse that,
+ # and ensure that the parameters appear in the correct order.
+ # Since this is parsing output from Argument Clinic, we can
+ # be reasonably certain the generated parsing code will be
+ # correct too.
+ human_readable_signature = stdscr.addch.__doc__.split("\n")[0]
+ offset = human_readable_signature.find("[y, x,]")
+ assert offset >= 0, ""
+
def main(stdscr):
curses.savetty()
try:
@@ -344,6 +373,7 @@ def main(stdscr):
test_unget_wch(stdscr)
test_issue10570()
test_encoding(stdscr)
+ test_issue21088(stdscr)
finally:
curses.resetty()