1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/mixin_only.py Fri Jun 16 00:37:50 2017 +0200
1.3 @@ -0,0 +1,33 @@
1.4 +class MixIn:
1.5 + def f(self):
1.6 + return self.g()
1.7 + def f2(self):
1.8 + return self.g2()
1.9 +
1.10 +class Concrete(MixIn):
1.11 + def g(self):
1.12 + return 13579
1.13 + def g2(self):
1.14 + return 13579
1.15 +
1.16 +class Cement(MixIn):
1.17 + def g2(self):
1.18 + return 24680
1.19 +
1.20 +m = MixIn()
1.21 +
1.22 +try:
1.23 + print m.f()
1.24 +except TypeError:
1.25 + print "m.f: cannot obtain attribute"
1.26 +
1.27 +c = Concrete()
1.28 +print c.f() # 13579
1.29 +
1.30 +try:
1.31 + print m.f2()
1.32 +except TypeError:
1.33 + print "m.f2: cannot obtain attribute"
1.34 +
1.35 +c2 = Cement()
1.36 +print c2.f2() # 24680