[pypy-svn] r34693 - pypy/dist/pypy/objspace/std/test
fijal at codespeak.net
fijal at codespeak.net
Thu Nov 16 21:37:10 CET 2006
Author: fijal
Date: Thu Nov 16 21:37:08 2006
New Revision: 34693
Modified:
pypy/dist/pypy/objspace/std/test/test_proxy.py
pypy/dist/pypy/objspace/std/test/test_proxy_function.py
Log:
Added some tests, which passes out of the box.
Modified: pypy/dist/pypy/objspace/std/test/test_proxy.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_proxy.py (original)
+++ pypy/dist/pypy/objspace/std/test/test_proxy.py Thu Nov 16 21:37:08 2006
@@ -88,6 +88,12 @@
lst = self.proxy(list, c.perform)
lst += [1,2,3]
assert len(lst) == 6
+
+ def test_list_reverse_add(self):
+ c = self.Controller([1,2,3])
+ lst = self.proxy(list, c.perform)
+ l = [1] + lst
+ assert l == [1,1,2,3]
class AppTestDictProxy(AppProxyBasic):
def test_dict(self):
Modified: pypy/dist/pypy/objspace/std/test/test_proxy_function.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_proxy_function.py (original)
+++ pypy/dist/pypy/objspace/std/test/test_proxy_function.py Thu Nov 16 21:37:08 2006
@@ -80,3 +80,25 @@
del fun.__doc__
assert f.__doc__ is None
+ def test_proxy_bind_method(self):
+ class A:
+ pass
+
+ def f(self):
+ return 3
+
+ class AA:
+ pass
+
+ from pypymagic import transparent_proxy as proxy
+ a = A()
+ class X:
+ def __init__(self, x):
+ self.x = x
+ def f(self, name, *args, **kwargs):
+ return getattr(self.x, name)(*args, **kwargs)
+
+ y = proxy(type(f), X(f).f)
+ x = proxy(AA, X(a).f)
+ AA.f = y
+ assert x.f() == 3
More information about the Pypy-commit
mailing list