summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/class_inherit_mul.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-31 19:45:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-31 19:46:35 +0300
commit183faa3b13d933a201f909465f8fcd432d616e04 (patch)
tree4f03814eae28bc55529e82139ce11f68f09ac8cf /tests/basics/class_inherit_mul.py
parent43e92cfb521db55fb2d0001388c0e3a532405b50 (diff)
downloadmicropython-183faa3b13d933a201f909465f8fcd432d616e04.tar.gz
micropython-183faa3b13d933a201f909465f8fcd432d616e04.zip
tests: Add testcase for multiple inheritance.
Diffstat (limited to 'tests/basics/class_inherit_mul.py')
-rw-r--r--tests/basics/class_inherit_mul.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/basics/class_inherit_mul.py b/tests/basics/class_inherit_mul.py
new file mode 100644
index 0000000000..23476132ba
--- /dev/null
+++ b/tests/basics/class_inherit_mul.py
@@ -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()