diff options
Diffstat (limited to 'tests/micropython/heapalloc_fail_set.py')
-rw-r--r-- | tests/micropython/heapalloc_fail_set.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/micropython/heapalloc_fail_set.py b/tests/micropython/heapalloc_fail_set.py new file mode 100644 index 000000000..98e615d64 --- /dev/null +++ b/tests/micropython/heapalloc_fail_set.py @@ -0,0 +1,21 @@ +# test handling of failed heap allocation with set + +import micropython + +# create set +x = 1 +micropython.heap_lock() +try: + {x,} +except MemoryError: + print('MemoryError: set create') +micropython.heap_unlock() + +# set copy +s = {1, 2} +micropython.heap_lock() +try: + s.copy() +except MemoryError: + print('MemoryError: set copy') +micropython.heap_unlock() |