[pypy-svn] r53269 - pypy/dist/pypy/lib/app_test/ctypes
fijal at codespeak.net
fijal at codespeak.net
Thu Apr 3 07:17:00 CEST 2008
Author: fijal
Date: Thu Apr 3 07:16:58 2008
New Revision: 53269
Added:
pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py (contents, props changed)
Log:
Add a test for guessing argtypes.
Added: pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py Thu Apr 3 07:16:58 2008
@@ -0,0 +1,29 @@
+
+""" This test checks whether args wrapping behavior is correct
+"""
+
+import sys
+
+from ctypes import *
+
+def test_wrap_args():
+ if not hasattr(sys, 'pypy_translation_info'):
+ py.test.skip("whitebox test")
+ from _ctypes.function import CFuncPtr
+
+ guess = CFuncPtr._guess_argtypes
+
+ assert guess([13]) == [c_int]
+ assert guess([0]) == [c_int]
+ assert guess(['xca']) == [c_char_p]
+ assert guess([None]) == [c_void_p]
+ assert guess([c_int(3)]) == [c_int]
+
+ class Stuff:
+ pass
+ s = Stuff()
+ s._as_parameter_ = None
+
+ assert guess([s]) == [c_void_p]
+
+ # not sure what else....
More information about the pypy-svn
mailing list