[Python-checkins] r58643 - python/trunk/Lib/ctypes/test/test_prototypes.py
thomas.heller
python-checkins at python.org
Wed Oct 24 21:50:45 CEST 2007
Author: thomas.heller
Date: Wed Oct 24 21:50:45 2007
New Revision: 58643
Modified:
python/trunk/Lib/ctypes/test/test_prototypes.py
Log:
Added unittest for calling a function with paramflags (backport from py3k branch).
Modified: python/trunk/Lib/ctypes/test/test_prototypes.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_prototypes.py (original)
+++ python/trunk/Lib/ctypes/test/test_prototypes.py Wed Oct 24 21:50:45 2007
@@ -48,6 +48,24 @@
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
More information about the Python-checkins
mailing list