1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/failure/attribute_access_type_restriction_new_impossible.py Sun Apr 18 21:10:41 2010 +0200
1.3 @@ -0,0 +1,36 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class C:
1.7 + def f(self):
1.8 + return 1
1.9 +
1.10 +class D:
1.11 + def f(self):
1.12 + return 2
1.13 +
1.14 + def g(self): # unused
1.15 + return 3
1.16 +
1.17 +class E:
1.18 + def f(self):
1.19 + return 4
1.20 +
1.21 + def h(self):
1.22 + return 5
1.23 +
1.24 +def test_new(obj):
1.25 + # obj: C, D, E (f)
1.26 + if obj.f(): # C, D, E (f)
1.27 + obj2 = D() # obj2: E (h) -> conflict!
1.28 + obj2.h() # E (h)
1.29 + # else:
1.30 + # ... # obj: C, D, E (f)
1.31 + # # (f) ^ (f)
1.32 + return obj.f() # C, D, E (f)
1.33 +
1.34 +c = C()
1.35 +d = D()
1.36 +e = E()
1.37 +result2_2 = test_new(c)
1.38 +
1.39 +# vim: tabstop=4 expandtab shiftwidth=4