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 """ 4 This test attempts to cause the recording of the usage of 'C' in the function 5 'f'. Meanwhile, the methods 'D.g' and 'E.h' should be eliminated. 6 """ 7 8 class C: 9 def f(self): 10 return 1 11 12 class D: 13 def g(self): # unused 14 return 2 15 16 class E: 17 def h(self): # unused 18 return 3 19 20 def f(c): 21 if 1: 22 return c.f() 23 else: 24 return 2 25 26 c = C() 27 d = D() 28 e = E() 29 result1_1 = f(c) 30 31 # vim: tabstop=4 expandtab shiftwidth=4