Commits

Armin Rigo committed f772351

Write a test for d4ed2c8ac9b1 (thanks lahwran for reporting it)

  • Participants
  • Parent commits d4ed2c8

Comments (0)

Files changed (1)

File pypy/module/test_lib_pypy/ctypes_tests/test_functions.py

         assert tf_b(-126) == -42
         assert tf_b._ptr is ptr
 
+    def test_custom_from_param(self):
+        class A(c_byte):
+            @classmethod
+            def from_param(cls, obj):
+                seen.append(obj)
+                return -126
+        tf_b = dll.tf_b
+        tf_b.restype = c_byte
+        tf_b.argtypes = (c_byte,)
+        tf_b.argtypes = [A]
+        seen = []
+        assert tf_b("yadda") == -42
+        assert seen == ["yadda"]
+
     def test_warnings(self):
         import warnings
         warnings.simplefilter("always")