2010-06-16 | Paul Boddie | file changeset files shortlog | Attempted to introduce a more conservative approach to visiting program units and collecting attributes. Moved the declaration of StopIteration into the inspection method for the "for" statement. Added module registration so that attribute collection successfully visits imported modules. |
paul@306 | 1 | #!/usr/bin/env python |
paul@306 | 2 | |
paul@306 | 3 | """ |
paul@306 | 4 | This test attempts to cause the recording of the usage of 'C' in the function |
paul@306 | 5 | 'g', alongside the expectation that 'D' might be used instead. A guard |
paul@306 | 6 | stipulating constraints for all of 'g' cannot therefore be generated. |
paul@306 | 7 | """ |
paul@306 | 8 | |
paul@306 | 9 | class C: |
paul@306 | 10 | def f(self): |
paul@306 | 11 | return 1 |
paul@306 | 12 | |
paul@306 | 13 | class D: |
paul@306 | 14 | def g(self): |
paul@306 | 15 | return 2 |
paul@306 | 16 | |
paul@306 | 17 | def h(self): |
paul@306 | 18 | return 3 |
paul@306 | 19 | |
paul@306 | 20 | def g(c): |
paul@306 | 21 | if 1: |
paul@306 | 22 | c.g() |
paul@306 | 23 | if 1: |
paul@306 | 24 | return c.h() |
paul@306 | 25 | return c.f() |
paul@306 | 26 | |
paul@306 | 27 | c = C() |
paul@306 | 28 | d = D() |
paul@306 | 29 | result1_3 = g(d) |
paul@306 | 30 | |
paul@306 | 31 | # vim: tabstop=4 expandtab shiftwidth=4 |