summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-10-24 19:50:45 (GMT)
committerThomas Heller <theller@ctypes.org>2007-10-24 19:50:45 (GMT)
commite7becc5007b8600402697513bdc74579dbc630d2 (patch)
tree8f64ce8a2bd9de39649f5c235cb7240f5b6c89a0 /Lib
parentf5ade63e91268dbc3dbfb0ca3244c61e2fc386b7 (diff)
downloadcpython-e7becc5007b8600402697513bdc74579dbc630d2.zip
cpython-e7becc5007b8600402697513bdc74579dbc630d2.tar.gz
cpython-e7becc5007b8600402697513bdc74579dbc630d2.tar.bz2
Added unittest for calling a function with paramflags (backport from py3k branch).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_prototypes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_prototypes.py b/Lib/ctypes/test/test_prototypes.py
index 9f02086..5a4117a 100644
--- a/Lib/ctypes/test/test_prototypes.py
+++ b/Lib/ctypes/test/test_prototypes.py
@@ -48,6 +48,24 @@ class CharPointersTestCase(unittest.TestCase):
func.restype = c_long
func.argtypes = None
+ def test_paramflags(self):
+ # function returns c_void_p result,
+ # and has a required parameter named 'input'
+ prototype = CFUNCTYPE(c_void_p, c_void_p)
+ func = prototype(("_testfunc_p_p", testdll),
+ ((1, "input"),))
+
+ try:
+ func()
+ except TypeError as details:
+ self.failUnlessEqual(str(details), "required argument 'input' missing")
+ else:
+ self.fail("TypeError not raised")
+
+ self.failUnlessEqual(func(None), None)
+ self.failUnlessEqual(func(input=None), None)
+
+
def test_int_pointer_arg(self):
func = testdll._testfunc_p_p
func.restype = c_long