1.1 --- a/tests/attribute_access_type_restriction_conditional.py Tue Apr 20 01:11:41 2010 +0200
1.2 +++ b/tests/attribute_access_type_restriction_conditional.py Wed Apr 21 00:58:29 2010 +0200
1.3 @@ -1,7 +1,13 @@
1.4 #!/usr/bin/env python
1.5
1.6 +"""
1.7 +This test attempts to record the usage of 'D' in 'test_conditional' since 'f'
1.8 +and 'g' are both normally required, and only 'D' provides these attributes.
1.9 +Classes 'C' and 'E' should lose their methods, even 'E.f'.
1.10 +"""
1.11 +
1.12 class C:
1.13 - def f(self):
1.14 + def f(self): # unused
1.15 return 1
1.16
1.17 class D:
1.18 @@ -12,19 +18,15 @@
1.19 return 3
1.20
1.21 class E:
1.22 - def f(self):
1.23 + def f(self): # unused
1.24 return 4
1.25
1.26 - def h(self):
1.27 + def h(self): # unused
1.28 return 5
1.29
1.30 def test_conditional(obj):
1.31 - # obj: C, D, E (f)
1.32 - if obj.f(): # C, D, E (f)
1.33 - obj.g() # D (f, g)
1.34 - # else:
1.35 - # ... # obj: C, D, E (f)
1.36 - # # (f, g) ^ (f)
1.37 + if obj.f():
1.38 + obj.g()
1.39 return 2
1.40
1.41 c = C()