1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attribute_access_type_restriction_all_new.py Thu Feb 25 01:22:21 2010 +0100
1.3 @@ -0,0 +1,41 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"""
1.7 +This test illustrates the need for propagation of usage to assignments providing
1.8 +active name definitions.
1.9 +"""
1.10 +
1.11 +class C:
1.12 + def f(self):
1.13 + return 1
1.14 +
1.15 +class D:
1.16 + def f(self):
1.17 + return 2
1.18 +
1.19 + def g(self):
1.20 + return 3
1.21 +
1.22 +class E:
1.23 + def f(self):
1.24 + return 4
1.25 +
1.26 + def h(self): # unused
1.27 + return 5
1.28 +
1.29 +def test_new(obj, obj2, obj3):
1.30 + # obj should support f
1.31 + if obj.f():
1.32 + obj = obj2 # should support f, g
1.33 + obj.g()
1.34 + else:
1.35 + obj = obj3 # should support f, g
1.36 + obj.g()
1.37 + return obj.f()
1.38 +
1.39 +c = C()
1.40 +d = D()
1.41 +e = E()
1.42 +result2_2 = test_new(c, d, d)
1.43 +
1.44 +# vim: tabstop=4 expandtab shiftwidth=4