[pypy-svn] r36487 - pypy/dist/pypy/annotation/test

fijal at codespeak.net fijal at codespeak.net
Thu Jan 11 15:39:26 CET 2007


Author: fijal
Date: Thu Jan 11 15:39:24 2007
New Revision: 36487

Modified:
   pypy/dist/pypy/annotation/test/test_annrpython.py
Log:
Added (skipped) tests for function with known signature


Modified: pypy/dist/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/annotation/test/test_annrpython.py	Thu Jan 11 15:39:24 2007
@@ -2450,6 +2450,36 @@
         s = a.build_types(fun, [])
         assert s.const == 0
 
+    def test_some_generic_function_call(self):
+        py.test.skip("Not implemented")
+        def g(a, b, c):
+            pass
+        g.known_signature = FunctionSignature(args=(3, 3, 3), retval=3)
+
+        def fun():
+            return g(1, 2, 3)
+        a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+        s = a.build_types(fun, [])
+        assert isinstance(s.returntype, annmodel.SomeInteger)
+        assert not hasattr(s.returntype, 'const')
+        # assert that a know the g
+
+    def test_some_genereic_function_callback(self):
+        py.test.skip("Not implemented")
+        def g(a):
+            pass
+        g.known_signature = FunctionSignature(args=
+            [FunctionSignature(args=[1])], retval=3)
+
+        def fun2(x):
+            return x
+
+        def fun():
+            return g(fun2)
+        
+        a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+        s = a.build_types(func, [])
+        # assert that annotator knows about fun2 and is flown well
 
 def g(n):
     return [0,1,2,n]



More information about the Pypy-commit mailing list