[pypy-svn] r70786 - pypy/branch/separate-compilation/pypy/rpython/test
afa at codespeak.net
afa at codespeak.net
Fri Jan 22 18:32:51 CET 2010
Author: afa
Date: Fri Jan 22 18:32:50 2010
New Revision: 70786
Modified:
pypy/branch/separate-compilation/pypy/rpython/test/test_controllerentry.py
Log:
A test that I would like to pass:
a Controller should be able to support method calls on the Controlled object.
Help needed!
Modified: pypy/branch/separate-compilation/pypy/rpython/test/test_controllerentry.py
==============================================================================
--- pypy/branch/separate-compilation/pypy/rpython/test/test_controllerentry.py (original)
+++ pypy/branch/separate-compilation/pypy/rpython/test/test_controllerentry.py Fri Jan 22 18:32:50 2010
@@ -30,6 +30,12 @@
def set_foo(self, obj, value):
value.append(obj)
+ # XXX this is probably not the right way
+ def get_compute(self, obj):
+ def compute(obj, arg):
+ return obj + arg
+ return compute
+
def getitem(self, obj, key):
return obj + key
@@ -112,3 +118,17 @@
assert ''.join(res.item0.chars) == "4_bar"
assert ''.join(res.item1.chars) == "4_foo"
assert ''.join(res.item2.chars) == "4_baz"
+
+def fun4(a):
+ c = C(a)
+ return c.compute('bar')
+
+def test_boundmethods_annotate():
+ a = RPythonAnnotator()
+ s = a.build_types(fun4, [a.bookkeeper.immutablevalue("5")])
+ assert s.const == "5_bar"
+
+def test_boundmethods_specialize():
+ res = interpret(fun4, ["5"])
+ assert ''.join(res.chars) == "5_bar"
+
More information about the Pypy-commit
mailing list