1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attribute_access_type_restriction.py Mon Oct 26 00:26:07 2009 +0100
1.3 @@ -0,0 +1,44 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class C:
1.7 + def f(self):
1.8 + return 1
1.9 +
1.10 +class D:
1.11 + def f(self):
1.12 + return 2
1.13 +
1.14 + def g(self):
1.15 + return 3
1.16 +
1.17 +def test_one(obj):
1.18 + obj.f()
1.19 + return obj.g()
1.20 +
1.21 +def test_neither(obj, obj2):
1.22 + if obj.f():
1.23 + obj = obj2
1.24 + obj.g()
1.25 + return 2
1.26 +
1.27 +def test_either(obj, obj2):
1.28 + if obj:
1.29 + obj = obj2
1.30 + obj.g()
1.31 + return obj.f()
1.32 +
1.33 +def test_neither2(obj, obj2):
1.34 + if obj:
1.35 + obj.g()
1.36 + else:
1.37 + obj.f()
1.38 + return 4
1.39 +
1.40 +c = C()
1.41 +d = D()
1.42 +result1_3 = test_one(d)
1.43 +result1_2 = test_neither(c, d)
1.44 +result2_2 = test_either(c, d)
1.45 +result1_4 = test_neither2(c, d)
1.46 +
1.47 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/tests/failure/instance.py Mon Oct 26 00:23:36 2009 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,18 +0,0 @@
2.4 -#!/usr/bin/env python
2.5 -
2.6 -class C:
2.7 - pass
2.8 -
2.9 -class D:
2.10 - def __init__(self):
2.11 - pass
2.12 -
2.13 -class E:
2.14 - def __init__(self, x):
2.15 - pass
2.16 -
2.17 -c = C()
2.18 -d = D()
2.19 -e = E()
2.20 -
2.21 -# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/failure/instance_initialisation_incomplete.py Mon Oct 26 00:26:07 2009 +0100
3.3 @@ -0,0 +1,18 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +class C:
3.7 + pass
3.8 +
3.9 +class D:
3.10 + def __init__(self):
3.11 + pass
3.12 +
3.13 +class E:
3.14 + def __init__(self, x):
3.15 + pass
3.16 +
3.17 +c = C()
3.18 +d = D()
3.19 +e = E()
3.20 +
3.21 +# vim: tabstop=4 expandtab shiftwidth=4