1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/methods.py Sun May 18 01:08:03 2008 +0200
1.3 @@ -0,0 +1,46 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +def f(x):
1.7 + pass
1.8 +
1.9 +class B:
1.10 + def f(self):
1.11 + pass
1.12 +
1.13 + Bf = f # context == parent
1.14 +
1.15 +b = B()
1.16 +
1.17 + # on A on a
1.18 +class A:
1.19 + f1 = f # unbound (A) bound (a)
1.20 + f2 = B.f # unbound (B) unbound (B)
1.21 + f3 = b.f # bound (b) bound (b)
1.22 + Bf = B.Bf # unbound (B) unbound (B)
1.23 +
1.24 + def __init__(self):
1.25 + self.f4 = f # N/A function
1.26 + self.f5 = B.f # N/A unbound (B)
1.27 + self.f6 = b.f # N/A bound (b)
1.28 +
1.29 + def m(self):
1.30 + self.f1
1.31 + self.f2
1.32 + self.f3
1.33 + self.f4
1.34 + self.f5
1.35 + self.f6
1.36 +
1.37 +a = A()
1.38 +
1.39 +A.f1
1.40 +A.f2
1.41 +A.f3
1.42 +a.f1
1.43 +a.f2
1.44 +a.f3
1.45 +a.f4
1.46 +a.f5
1.47 +a.f6
1.48 +
1.49 +# vim: tabstop=4 expandtab shiftwidth=4