summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics')
-rw-r--r--tests/basics/class_inherit_mul.py5
-rw-r--r--tests/basics/class_super_multinherit.py16
-rw-r--r--tests/basics/sys_getsizeof.py15
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/basics/class_inherit_mul.py b/tests/basics/class_inherit_mul.py
index 23476132ba..4a43a7f410 100644
--- a/tests/basics/class_inherit_mul.py
+++ b/tests/basics/class_inherit_mul.py
@@ -1,3 +1,5 @@
+# test multiple inheritance of user classes
+
class A:
def __init__(self, x):
print('A init', x)
@@ -30,6 +32,9 @@ class Sub(A, B):
def g(self):
print(self.x)
+print(issubclass(Sub, A))
+print(issubclass(Sub, B))
+
o = Sub()
print(o.x)
o.f()
diff --git a/tests/basics/class_super_multinherit.py b/tests/basics/class_super_multinherit.py
new file mode 100644
index 0000000000..642a73ce1a
--- /dev/null
+++ b/tests/basics/class_super_multinherit.py
@@ -0,0 +1,16 @@
+# test super with multiple inheritance
+
+class A:
+ def foo(self):
+ print('A.foo')
+
+class B:
+ def foo(self):
+ print('B.foo')
+
+class C(A, B):
+ def foo(self):
+ print('C.foo')
+ super().foo()
+
+C().foo()
diff --git a/tests/basics/sys_getsizeof.py b/tests/basics/sys_getsizeof.py
new file mode 100644
index 0000000000..d16eb1561a
--- /dev/null
+++ b/tests/basics/sys_getsizeof.py
@@ -0,0 +1,15 @@
+# test sys.getsizeof() function
+
+import sys
+try:
+ sys.getsizeof
+except AttributeError:
+ print('SKIP')
+ raise SystemExit
+
+print(sys.getsizeof([1, 2]) >= 2)
+print(sys.getsizeof({1: 2}) >= 2)
+
+class A:
+ pass
+print(sys.getsizeof(A()) > 0)