summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/micropython/heapalloc_exc_compressed.py16
-rw-r--r--tests/micropython/heapalloc_exc_compressed.py.exp6
-rw-r--r--tests/micropython/heapalloc_exc_compressed_emg_exc.py10
-rw-r--r--tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp4
4 files changed, 16 insertions, 20 deletions
diff --git a/tests/micropython/heapalloc_exc_compressed.py b/tests/micropython/heapalloc_exc_compressed.py
index 79e423ca0..aa071d641 100644
--- a/tests/micropython/heapalloc_exc_compressed.py
+++ b/tests/micropython/heapalloc_exc_compressed.py
@@ -5,12 +5,10 @@ import micropython
# mp_obj_new_exception_msg (decompression can be deferred)
# NameError uses mp_obj_new_exception_msg_varg for NameError("name '%q' isn't defined")
-# set.pop uses mp_obj_new_exception_msg for KeyError("pop from an empty set")
+# `raise 0` uses mp_obj_new_exception_msg for TypeError("exceptions must derive from BaseException")
# Tests that deferred decompression works both via print(e) and accessing the message directly via e.args.
-a = set()
-
# First test the regular case (can use heap for allocating the decompression buffer).
try:
name()
@@ -18,8 +16,8 @@ except NameError as e:
print(type(e).__name__, e)
try:
- a.pop()
-except KeyError as e:
+ raise 0
+except TypeError as e:
print(type(e).__name__, e)
try:
@@ -28,8 +26,8 @@ except NameError as e:
print(e.args[0])
try:
- a.pop()
-except KeyError as e:
+ raise 0
+except TypeError as e:
print(e.args[0])
# Then test that it still works when the heap is locked (i.e. in ISR context).
@@ -41,8 +39,8 @@ except NameError as e:
print(type(e).__name__)
try:
- a.pop()
-except KeyError as e:
+ raise 0
+except TypeError as e:
print(type(e).__name__)
micropython.heap_unlock()
diff --git a/tests/micropython/heapalloc_exc_compressed.py.exp b/tests/micropython/heapalloc_exc_compressed.py.exp
index 32d1642f8..c3e6e5dd9 100644
--- a/tests/micropython/heapalloc_exc_compressed.py.exp
+++ b/tests/micropython/heapalloc_exc_compressed.py.exp
@@ -1,6 +1,6 @@
NameError name 'name' isn't defined
-KeyError pop from an empty set
+TypeError exceptions must derive from BaseException
name 'name' isn't defined
-pop from an empty set
+exceptions must derive from BaseException
NameError
-KeyError
+TypeError
diff --git a/tests/micropython/heapalloc_exc_compressed_emg_exc.py b/tests/micropython/heapalloc_exc_compressed_emg_exc.py
index 86ade0786..48ce9dd69 100644
--- a/tests/micropython/heapalloc_exc_compressed_emg_exc.py
+++ b/tests/micropython/heapalloc_exc_compressed_emg_exc.py
@@ -9,8 +9,6 @@ try:
except AttributeError:
pass
-a = set()
-
def test():
micropython.heap_lock()
@@ -21,8 +19,8 @@ def test():
print(type(e).__name__, e)
try:
- a.pop()
- except KeyError as e:
+ raise 0
+ except TypeError as e:
print(type(e).__name__, e)
try:
@@ -31,8 +29,8 @@ def test():
print(e.args[0])
try:
- a.pop()
- except KeyError as e:
+ raise 0
+ except TypeError as e:
print(e.args[0])
micropython.heap_unlock()
diff --git a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp
index 7c368712a..1fc810933 100644
--- a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp
+++ b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp
@@ -1,4 +1,4 @@
NameError name 'name' isn't defined
-KeyError pop from an empty set
+TypeError exceptions must derive from BaseException
name 'name' isn't defined
-pop from an empty set
+exceptions must derive from BaseException