micropython

Change of tests/attributes_instance_bind_method.py

230:892b13f1cba4
tests/attributes_instance_bind_method.py
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tests/attributes_instance_bind_method.py	Sat May 30 20:27:20 2009 +0200
     1.3 @@ -0,0 +1,32 @@
     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 +    def m(self, x):
    1.10 +        return x
    1.11 +
    1.12 +class A:
    1.13 +    c1 = B
    1.14 +    m1 = B.m
    1.15 +    def __init__(self, b):
    1.16 +        self.c2 = B
    1.17 +        self.m2 = B.m
    1.18 +        self.c3 = b
    1.19 +        self.m3 = b.m
    1.20 +
    1.21 +b = B(789)
    1.22 +a = A(b)
    1.23 +result_123 = A.m1(b, 123) # A.m1 is unbound
    1.24 +result_234 = a.m1(b, 234) # a.m1 is unbound
    1.25 +result_345 = a.m2(b, 345) # a.m2 is unbound
    1.26 +result_456 = a.m3(456)    # a.m3 is bound to b
    1.27 +
    1.28 +b1 = A.c1(678)            # A.c1 is just a reference to B
    1.29 +result_678 = b1.y
    1.30 +b2 = a.c1(567)            # a.c1 is just a reference to B
    1.31 +result_567 = b2.y
    1.32 +b3 = a.c2(765)            # a.c2 is just a reference to B
    1.33 +result_765 = b3.y
    1.34 +
    1.35 +# vim: tabstop=4 expandtab shiftwidth=4