1.1 --- a/tests/attribute_access_type_restriction.py Sun Feb 07 03:02:39 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,60 +0,0 @@
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):
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, obj2):
1.25 - # obj: C, D, E (f)
1.26 - # obj2:
1.27 - if obj.f(): # C, D, E (f)
1.28 - obj = obj2 # obj: D (g)
1.29 - obj.g() # D (g)
1.30 - # else:
1.31 - # ... # obj: C, D, E (f)
1.32 - # # (g) ^ (f)
1.33 - return obj.f() # C, D, E (f)
1.34 -
1.35 -def test_neither(obj, obj2):
1.36 - # obj:
1.37 - # obj2:
1.38 - if 0:
1.39 - obj.g() # D (g)
1.40 - else:
1.41 - obj.f() # C, D, E (f)
1.42 - # # (g) ^ (f)
1.43 - return 4
1.44 -
1.45 -def test_new_conditional(obj, obj2):
1.46 - # obj:
1.47 - # obj2:
1.48 - if obj.f(): # C, D, E (f)
1.49 - obj = obj2 # obj: D (g)
1.50 - obj.g() # D (g)
1.51 - else:
1.52 - obj.h() # E (f, h)
1.53 - # # (g) ^ (f, h)
1.54 - return 5
1.55 -
1.56 -c = C()
1.57 -d = D()
1.58 -e = E()
1.59 -result2_2 = test_new(c, d)
1.60 -result1_4 = test_neither(c, d)
1.61 -result1_5 = test_new_conditional(e, d)
1.62 -
1.63 -# vim: tabstop=4 expandtab shiftwidth=4