[pypy-svn] r48284 - pypy/dist/pypy/rpython/test

fijal at codespeak.net fijal at codespeak.net
Sun Nov 4 14:40:04 CET 2007


Author: fijal
Date: Sun Nov  4 14:40:04 2007
New Revision: 48284

Modified:
   pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
Add (skipped) test for possible missing attribute. should at least give some
warning or explode


Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py	Sun Nov  4 14:40:04 2007
@@ -1565,6 +1565,34 @@
 
         self.interpret_raises(NotImplementedError, f, [7])
 
+    def test_possible_missing_attribute_access(self):
+        py.test.skip("Should explode or give some warning")
+        class Base(object):
+            pass
+
+        class A(Base):
+            a = 1
+            b = 2
+
+        class B(Base):
+            a = 2
+            b = 2
+
+        class C(Base):
+            b = 8
+
+        def f(n):
+            if n > 3:
+                x = A
+            elif n > 1:
+                x = B
+            else:
+                x = C
+            if n > 0:
+                return x.a
+            return 9
+
+        self.interpret(f, [int])
 
 class TestLLtype(BaseTestRPBC, LLRtypeMixin):
     pass



More information about the Pypy-commit mailing list