1 #!/usr/bin/env python 2 3 """ 4 This test illustrates the need for usage to be propagated forward to the 5 assignment within the loop. 6 """ 7 8 class C: 9 def e(self): # unused 10 return 1 11 12 def f(self): 13 return 1 14 15 class D: 16 def f(self): 17 return 2 18 19 def g(self): 20 return 3 21 22 class E: 23 def e(self): 24 return 4 25 26 def f(self): 27 return 0 # stops the test loop 28 29 def g(self): 30 return 5 31 32 def test_loop(obj, obj2): 33 while obj.f(): 34 obj.g() 35 obj = obj2 # should support e, f, g 36 obj.e() 37 return obj.f() 38 39 c = C() 40 d = D() 41 e = E() 42 result1_0 = test_loop(d, e) 43 44 # vim: tabstop=4 expandtab shiftwidth=4