tests: Add testcase for multiple inheritance.

This commit is contained in:
Paul Sokolovsky 2014-03-31 19:45:17 +03:00
parent 43e92cfb52
commit 183faa3b13
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x)
def f2(self):
print(self.x)
class B:
def __init__(self, x):
print('B init', x)
self.x = x
def f(self):
print(self.x)
def f3(self):
print(self.x)
class Sub(A, B):
def __init__(self):
A.__init__(self, 1)
B.__init__(self, 2)
print('Sub init')
def g(self):
print(self.x)
o = Sub()
print(o.x)
o.f()
o.f2()
o.f3()