Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r62729:0fe403f2aae2
Date: 2013-03-24 23:52 -0700
http://bitbucket.org/pypy/pypy/changeset/0fe403f2aae2/
Log: write a passing test
diff --git a/rpython/annotator/test/test_annrpython.py
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -3922,6 +3922,28 @@
a = self.RPythonAnnotator()
assert a.build_types(f, []).const is True
+ def test_specific_attributes(self):
+ class A(object):
+ pass
+
+ class B(A):
+ def __init__(self, x):
+ assert x >= 0
+ self.x = x
+
+ def fn(i):
+ if i % 2:
+ a = A()
+ else:
+ a = B(3)
+ if i % 3:
+ a.x = -3
+ if isinstance(a, B):
+ return a.x
+ return 0
+
+ a = self.RPythonAnnotator()
+ assert not a.build_types(fn, [int]).nonneg
def g(n):
return [0, 1, 2, n]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit