1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attributes_instance_bind_initialiser.py Sat May 30 20:30:28 2009 +0200
1.3 @@ -0,0 +1,23 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class B:
1.7 + def __init__(self, y):
1.8 + self.y = y
1.9 +
1.10 +class A:
1.11 + c1 = B
1.12 + def __init__(self, b):
1.13 + self.c2 = B
1.14 + self.c3 = b
1.15 +
1.16 +b = B(789)
1.17 +a = A(b)
1.18 +
1.19 +b1 = A.c1(678) # A.c1 is just a reference to B
1.20 +result_678 = b1.y
1.21 +b2 = a.c1(567) # a.c1 is just a reference to B
1.22 +result_567 = b2.y
1.23 +b3 = a.c2(765) # a.c2 is just a reference to B
1.24 +result_765 = b3.y
1.25 +
1.26 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/tests/attributes_instance_bind_method.py Sat May 30 20:27:20 2009 +0200
2.2 +++ b/tests/attributes_instance_bind_method.py Sat May 30 20:30:28 2009 +0200
2.3 @@ -7,12 +7,9 @@
2.4 return x
2.5
2.6 class A:
2.7 - c1 = B
2.8 m1 = B.m
2.9 def __init__(self, b):
2.10 - self.c2 = B
2.11 self.m2 = B.m
2.12 - self.c3 = b
2.13 self.m3 = b.m
2.14
2.15 b = B(789)
2.16 @@ -22,11 +19,4 @@
2.17 result_345 = a.m2(b, 345) # a.m2 is unbound
2.18 result_456 = a.m3(456) # a.m3 is bound to b
2.19
2.20 -b1 = A.c1(678) # A.c1 is just a reference to B
2.21 -result_678 = b1.y
2.22 -b2 = a.c1(567) # a.c1 is just a reference to B
2.23 -result_567 = b2.y
2.24 -b3 = a.c2(765) # a.c2 is just a reference to B
2.25 -result_765 = b3.y
2.26 -
2.27 # vim: tabstop=4 expandtab shiftwidth=4