2012-05-14 | Paul Boddie | file changeset files shortlog | Improved support for specific type annotations in program regions. |
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@387 | 11 | return 0 |
paul@387 | 12 | |
paul@387 | 13 | class D: |
paul@387 | 14 | def f(self): |
paul@306 | 15 | return 1 |
paul@306 | 16 | |
paul@306 | 17 | def g(self): |
paul@306 | 18 | return 2 |
paul@306 | 19 | |
paul@306 | 20 | def h(self): |
paul@306 | 21 | return 3 |
paul@306 | 22 | |
paul@306 | 23 | def g(c): |
paul@306 | 24 | if 1: |
paul@306 | 25 | c.g() |
paul@306 | 26 | if 1: |
paul@306 | 27 | return c.h() |
paul@306 | 28 | return c.f() |
paul@306 | 29 | |
paul@306 | 30 | c = C() |
paul@306 | 31 | d = D() |
paul@306 | 32 | result1_3 = g(d) |
paul@306 | 33 | |
paul@306 | 34 | # vim: tabstop=4 expandtab shiftwidth=4 |