[pypy-svn] pypy default: A failing test.

arigo commits-noreply at bitbucket.org
Sun Mar 13 18:15:44 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42559:36a4bd1865c6
Date: 2011-03-13 11:00 -0400
http://bitbucket.org/pypy/pypy/changeset/36a4bd1865c6/

Log:	A failing test.

diff --git a/pypy/rpython/test/test_rpbc.py b/pypy/rpython/test/test_rpbc.py
--- a/pypy/rpython/test/test_rpbc.py
+++ b/pypy/rpython/test/test_rpbc.py
@@ -617,6 +617,32 @@
         assert self.read_attr(res, "z") == -7645
         assert self.read_attr(res, "extra") == 42
 
+    def test_call_classes_with_noarg_init(self):
+        class A:
+            foo = 21
+        class B(A):
+            foo = 22
+        class C(A):
+            def __init__(self):
+                self.foo = 42
+        class D(A):
+            def __init__(self):
+                self.foo = 43
+        def f(i):
+            if i == 1:
+                cls = B
+            elif i == 2:
+                cls = D
+            else:
+                cls = C
+            return cls().foo
+        res = self.interpret(f, [0])
+        assert res == 42
+        res = self.interpret(f, [1])
+        assert res == 22
+        res = self.interpret(f, [2])
+        assert res == 43
+
     def test_conv_from_None(self):
         class A(object): pass
         def none():


More information about the Pypy-commit mailing list