[pypy-svn] r37084 - pypy/dist/pypy/rpython/test

exarkun at codespeak.net exarkun at codespeak.net
Sun Jan 21 00:20:23 CET 2007


Author: exarkun
Date: Sun Jan 21 00:20:22 2007
New Revision: 37084

Modified:
   pypy/dist/pypy/rpython/test/test_extfunc.py
Log:
test which exercises tuple/SomeTuple codepath in pypy.annotation.signature.annotation

Modified: pypy/dist/pypy/rpython/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/rpython/test/test_extfunc.py	Sun Jan 21 00:20:22 2007
@@ -88,3 +88,28 @@
     a = RPythonAnnotator(policy=policy)
     s = a.build_types(f, [])
     assert isinstance(s, annmodel.SomeInteger)
+
+
+def function_with_tuple_arg():
+    """
+    Dummy function which is declared via register_external to take a tuple as
+    an argument so that register_external's behavior for tuple-taking functions
+    can be verified.
+    """
+register_external(function_with_tuple_arg, [(int,)], int)
+
+def test_register_external_tuple_args():
+    """
+    Verify the annotation of a registered external function which takes a tuple
+    argument.
+    """
+    def f():
+        return function_with_tuple_arg((1,))
+
+    policy = AnnotatorPolicy()
+    policy.allow_someobjects = False
+    a = RPythonAnnotator(policy=policy)
+    s = a.build_types(f, [])
+
+    # Not a very good assertion, but at least it means _something_ happened.
+    assert isinstance(s, annmodel.SomeInteger)



More information about the Pypy-commit mailing list