3dc324d3f1
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
36 lines
571 B
Python
36 lines
571 B
Python
# test super() operations which don't require allocation
|
|
import micropython
|
|
|
|
# Check for stackless build, which can't call functions without
|
|
# allocating a frame on heap.
|
|
try:
|
|
|
|
def stackless():
|
|
pass
|
|
|
|
micropython.heap_lock()
|
|
stackless()
|
|
micropython.heap_unlock()
|
|
except RuntimeError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
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()
|