[ctypes-commit] ctypes/unittests test_paramflags.py,1.3,1.4
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-03-09 16:43:22
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3430 Modified Files: test_paramflags.py Log Message: Support for [in, out] parameterflags added. Index: test_paramflags.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_paramflags.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_paramflags.py 9 Mar 2005 13:49:43 -0000 1.3 --- test_paramflags.py 9 Mar 2005 16:43:12 -0000 1.4 *************** *** 122,133 **** dll = CDLL(_ctypes_test.__file__) ! # this is not yet implemented proto = CFUNCTYPE(None, c_int, POINTER(c_int), c_int, POINTER(c_int)) ! self.failUnlessRaises(TypeError, ! lambda: proto("TwoOutArgs", dll, ! ((1, "a"), ! (3, "p1"), ! (1, "b"), ! (2, "p2")))) if __name__ == "__main__": --- 122,136 ---- dll = CDLL(_ctypes_test.__file__) ! # the COM idl of this function would be: ! # void TwoOutArgs([in] int a, [in, out] int *p1, [in] int b, [in, out] int *p2); proto = CFUNCTYPE(None, c_int, POINTER(c_int), c_int, POINTER(c_int)) ! func = proto("TwoOutArgs", dll, ((1, "a"), (3, "p1"), (1, "b"), (3, "p2"))) ! # The function returns ((a + p1), (b + p2)) ! self.failUnlessEqual((3, 7), func(1, 2, 3, 4)) ! self.failUnlessEqual((10, 14), func(a=1, b=3, p1=9, p2=11)) ! # TypeError: required argument 'p1' is missing ! self.assertRaises(TypeError, lambda: func(a=1, b=3)) ! # TypeError: required argument 'p2' is missing ! self.assertRaises(TypeError, lambda: func(a=1, b=3, p1=3)) if __name__ == "__main__": |