summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-19 00:47:40 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-19 00:47:40 +0000
commitebde0b8a095653ed3073cf821c44e91ec0897a41 (patch)
treec26de632e09ec92ccb4816fd5ba062d6c34b90dd /tests
parenta8a6db2a1ddffc9c1f5c9894ac5837ec3bc7c025 (diff)
Tiny optimisation in objlist.c; a new test for inheritance.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/tests/class_inherit1.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/basics/tests/class_inherit1.py b/tests/basics/tests/class_inherit1.py
new file mode 100644
index 000000000..9ca2d9f14
--- /dev/null
+++ b/tests/basics/tests/class_inherit1.py
@@ -0,0 +1,21 @@
+class A:
+ def __init__(self, x):
+ print('A init', x)
+ self.x = x
+
+ def f(self):
+ print(self.x, self.y)
+
+class B(A):
+ def __init__(self, x, y):
+ A.__init__(self, x)
+ print('B init', x, y)
+ self.y = y
+
+ def g(self):
+ print(self.x, self.y)
+
+A(1)
+b = B(1, 2)
+b.f()
+b.g()