2010-06-11 | Paul Boddie | file changeset files shortlog | Replaced the native mechanism for list initialisation with a Python-based list.__init__ method and a simplified native method for initialising the initial list fragment. Introduced automatic namespace traversal of __init__ attributes for any namespace providing such attributes. Unfortunately, this inflates the program size substantially and needs to be reviewed. Enabled proper testing of xrange instances using the updated support for list initialisation. |
paul@288 | 1 | #!/usr/bin/env python |
paul@288 | 2 | |
paul@323 | 3 | """ |
paul@323 | 4 | This test attempts to record the usage of 'D' in 'test_conditional' since 'f' |
paul@323 | 5 | and 'g' are both normally required, and only 'D' provides these attributes. |
paul@323 | 6 | Classes 'C' and 'E' should lose their methods, even 'E.f'. |
paul@323 | 7 | """ |
paul@323 | 8 | |
paul@288 | 9 | class C: |
paul@323 | 10 | def f(self): # unused |
paul@288 | 11 | return 1 |
paul@288 | 12 | |
paul@288 | 13 | class D: |
paul@288 | 14 | def f(self): |
paul@288 | 15 | return 2 |
paul@288 | 16 | |
paul@288 | 17 | def g(self): |
paul@288 | 18 | return 3 |
paul@288 | 19 | |
paul@288 | 20 | class E: |
paul@323 | 21 | def f(self): # unused |
paul@288 | 22 | return 4 |
paul@288 | 23 | |
paul@323 | 24 | def h(self): # unused |
paul@288 | 25 | return 5 |
paul@288 | 26 | |
paul@288 | 27 | def test_conditional(obj): |
paul@323 | 28 | if obj.f(): |
paul@323 | 29 | obj.g() |
paul@288 | 30 | return 2 |
paul@288 | 31 | |
paul@288 | 32 | c = C() |
paul@288 | 33 | d = D() |
paul@288 | 34 | e = E() |
paul@288 | 35 | result1_2 = test_conditional(d) |
paul@288 | 36 | |
paul@288 | 37 | # vim: tabstop=4 expandtab shiftwidth=4 |