1.1 --- a/tests/attribute_access_type_restriction.py Sat Nov 07 02:36:33 2009 +0100
1.2 +++ b/tests/attribute_access_type_restriction.py Mon Nov 16 00:34:47 2009 +0100
1.3 @@ -18,56 +18,53 @@
1.4 def h(self):
1.5 return 5
1.6
1.7 -def test_one(obj):
1.8 - obj.f() # C, D, E -> D
1.9 - return obj.g() # D
1.10 - # obj: D
1.11 -
1.12 -def test_two(obj, obj2):
1.13 +def test_conditional(obj):
1.14 + # obj: C, D, E (f)
1.15 if obj.f(): # C, D, E (f)
1.16 obj.g() # D (f, g)
1.17 # else:
1.18 # ... # obj: C, D, E (f)
1.19 # # (f, g) ^ (f)
1.20 return 2
1.21 - # obj: C, D, E (f)
1.22
1.23 def test_new(obj, obj2):
1.24 + # obj: C, D, E (f)
1.25 + # obj2:
1.26 if obj.f(): # C, D, E (f)
1.27 - obj = obj2
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 - # obj: C, D, E (f)
1.35
1.36 def test_neither(obj, obj2):
1.37 + # obj:
1.38 + # obj2:
1.39 if 0:
1.40 obj.g() # D (g)
1.41 else:
1.42 obj.f() # C, D, E (f)
1.43 # # (g) ^ (f)
1.44 return 4
1.45 +
1.46 +def test_new_conditional(obj, obj2):
1.47 # obj:
1.48 -
1.49 -def test_three(obj, obj2):
1.50 + # obj2:
1.51 if obj.f(): # C, D, E (f)
1.52 - obj = obj2
1.53 + obj = obj2 # obj: D (g)
1.54 obj.g() # D (g)
1.55 else:
1.56 obj.h() # E (f, h)
1.57 # # (g) ^ (f, h)
1.58 return 5
1.59 - # obj:
1.60
1.61 c = C()
1.62 d = D()
1.63 e = E()
1.64 -result1_3 = test_one(d)
1.65 -result1_2 = test_two(c, d)
1.66 +result1_2 = test_conditional(d)
1.67 result2_2 = test_new(c, d)
1.68 result1_4 = test_neither(c, d)
1.69 -result1_5 = test_three(e, d)
1.70 +result1_5 = test_new_conditional(e, d)
1.71
1.72 # vim: tabstop=4 expandtab shiftwidth=4