2012-02-27 | Paul Boddie | raw annotate files changeset graph | Added general attribute usage recording for attribute assignments on self, even though specific attribute usage is also recorded. This prevents usage from being inadvertently incomplete. Added tests demonstrating the contribution of attribute assignments to usage observations. |
1 #!/usr/bin/env python 2 3 class C: 4 def f(self): 5 return 1 6 7 class D: 8 def f(self): 9 return 2 10 11 def g(self): 12 return 3 13 14 class E: 15 def f(self): 16 return 4 17 18 def h(self): 19 return 5 20 21 def test_new_conditional(obj, obj2): 22 # obj: f; f, h 23 if obj.f(): 24 obj = obj2 # obj: g 25 obj.g() 26 else: 27 obj.h() 28 29 return 5 30 31 c = C() 32 d = D() 33 e = E() 34 result1_5 = test_new_conditional(e, d) 35 36 # vim: tabstop=4 expandtab shiftwidth=4