Skip to content

Commit 7839b8b

Browse files
committed
tests/micropython/heapalloc_iter: Add tests for contains and unpack.
1 parent e6003f4 commit 7839b8b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/micropython/heapalloc_iter.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ def gen_func():
2525
g1 = (100 + x for x in range(2))
2626
g2 = gen_func()
2727

28+
# test containment (both success and failure) with the heap locked
29+
heap_lock()
30+
print(49 in b'123', 255 in b'123')
31+
print(1 in t, -1 in t)
32+
print(1 in l, -1 in l)
33+
print(1 in d, -1 in d)
34+
print(1 in s, -1 in s)
35+
heap_unlock()
36+
37+
# test unpacking with the heap locked
38+
unp0 = unp1 = unp2 = None # preallocate slots for globals
39+
heap_lock()
40+
unp0, unp1, unp2 = t
41+
print(unp0, unp1, unp2)
42+
heap_unlock()
43+
2844
# test certain builtins with the heap locked
2945
heap_lock()
3046
print(all(t))

0 commit comments

Comments
 (0)