summaryrefslogtreecommitdiff
path: root/tests/micropython/heapalloc_super.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-04-19 09:49:48 +1000
committerDamien George <damien.p.george@gmail.com>2017-04-22 23:39:38 +1000
commit30badd1ce1fabd26e54fc445f07846306aa19cef (patch)
tree67eb4859d6acd8e234532e1a1ea5b4691e5dbdf6 /tests/micropython/heapalloc_super.py
parentdd11af209d226b7d18d5148b239662e30ed60bad (diff)
tests: Add tests for calling super and loading a method directly.
Diffstat (limited to 'tests/micropython/heapalloc_super.py')
-rw-r--r--tests/micropython/heapalloc_super.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/micropython/heapalloc_super.py b/tests/micropython/heapalloc_super.py
new file mode 100644
index 000000000..1cf5293d2
--- /dev/null
+++ b/tests/micropython/heapalloc_super.py
@@ -0,0 +1,17 @@
+# test super() operations which don't require allocation
+import micropython
+
+class A:
+ def foo(self):
+ print('A foo')
+ return 42
+class B(A):
+ def foo(self):
+ print('B foo')
+ print(super().foo())
+
+b = B()
+
+micropython.heap_lock()
+b.foo()
+micropython.heap_unlock()