[pypy-svn] r57139 - pypy/branch/garden-call-code/pypy/interpreter/test

pedronis at codespeak.net pedronis at codespeak.net
Sat Aug 9 17:06:22 CEST 2008


Author: pedronis
Date: Sat Aug  9 17:06:21 2008
New Revision: 57139

Modified:
   pypy/branch/garden-call-code/pypy/interpreter/test/test_gateway.py
Log:
tests showing current situation for BuiltinCodePassThroughArguments1 optimization



Modified: pypy/branch/garden-call-code/pypy/interpreter/test/test_gateway.py
==============================================================================
--- pypy/branch/garden-call-code/pypy/interpreter/test/test_gateway.py	(original)
+++ pypy/branch/garden-call-code/pypy/interpreter/test/test_gateway.py	Sat Aug  9 17:06:21 2008
@@ -553,7 +553,35 @@
         # no opt in this case
         assert len(called) == 2      
         assert called[0] == 'funcrun'
+        called = []
 
+        # higher level interfaces
+
+        w_res = space.call_function(w_g, w_self)
+        assert space.is_true(space.eq(w_res, space.wrap(('g', 'self'))))
+        assert len(called) == 2              
+        assert called[0] == 'funcrun' # bad
+        called = []
+        
+        w_res = space.appexec([w_g], """(g):
+        return g('self', 11)
+        """)
+        assert space.is_true(space.eq(w_res, space.wrap(('g', 'self', 11))))
+        assert len(called) == 2              
+        assert called[0] == 'funcrun' # bad
+        called = []
+        
+        w_res = space.appexec([w_g], """(g):
+        class A(object):
+           m = g # not a builtin function, so works as method
+        a = A()
+        y = a.m(33)        
+        return y == ('g', a, 33)
+        """)
+        assert space.is_true(w_res)
+        assert len(called) == 1
+        assert isinstance(called[0], argument.AbstractArguments)
+        
 
 class AppTestKeywordsToBuiltinSanity(object):
 



More information about the Pypy-commit mailing list