From 30badd1ce1fabd26e54fc445f07846306aa19cef Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 19 Apr 2017 09:49:48 +1000 Subject: tests: Add tests for calling super and loading a method directly. --- tests/micropython/heapalloc_super.py | 17 +++++++++++++++++ tests/micropython/heapalloc_super.py.exp | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 tests/micropython/heapalloc_super.py create mode 100644 tests/micropython/heapalloc_super.py.exp (limited to 'tests/micropython') 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() diff --git a/tests/micropython/heapalloc_super.py.exp b/tests/micropython/heapalloc_super.py.exp new file mode 100644 index 000000000..5dabd0c7c --- /dev/null +++ b/tests/micropython/heapalloc_super.py.exp @@ -0,0 +1,3 @@ +B foo +A foo +42 -- cgit v1.2.3