2012-02-27 | Paul Boddie | file changeset files shortlog | 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. |
paul@417 | 1 | #!/usr/bin/env python |
paul@417 | 2 | |
paul@417 | 3 | class C: |
paul@417 | 4 | def clsattr(self): |
paul@417 | 5 | return 123 |
paul@417 | 6 | def clsattr2(self): |
paul@417 | 7 | return 456 |
paul@417 | 8 | |
paul@417 | 9 | def a(x): |
paul@417 | 10 | return 789 |
paul@417 | 11 | |
paul@417 | 12 | def b(x): |
paul@417 | 13 | return 234 |
paul@417 | 14 | |
paul@417 | 15 | C.clsattr = a |
paul@417 | 16 | C.clsattr2 = b |
paul@417 | 17 | |
paul@417 | 18 | c = C() |
paul@417 | 19 | |
paul@417 | 20 | result_789 = c.a() |
paul@417 | 21 | result_234 = c.b() |
paul@417 | 22 | |
paul@417 | 23 | # vim: tabstop=4 expandtab shiftwidth=4 |