1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attribute_access_type_restriction_loop_else.py Mon Sep 13 23:52:01 2010 +0200
1.3 @@ -0,0 +1,40 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class C:
1.7 + def e(self):
1.8 + return 2
1.9 +
1.10 + def f(self):
1.11 + return 1
1.12 +
1.13 +class D:
1.14 + def e(self):
1.15 + return 6
1.16 +
1.17 + def f(self):
1.18 + return 0 # stops the test loop
1.19 +
1.20 + def g(self):
1.21 + return 3
1.22 +
1.23 +class E:
1.24 + def f(self):
1.25 + return 4
1.26 +
1.27 + def h(self): # unused
1.28 + return 5
1.29 +
1.30 +def test_loop(obj, obj2):
1.31 + while obj.f():
1.32 + obj = obj2
1.33 + obj.g()
1.34 + else:
1.35 + obj.e()
1.36 + return obj.f()
1.37 +
1.38 +c = C()
1.39 +d = D()
1.40 +e = E()
1.41 +result1_0 = test_loop(c, d)
1.42 +
1.43 +# vim: tabstop=4 expandtab shiftwidth=4