summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-13 15:45:24 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-16 19:11:34 +1100
commit7839b8b827199ce593bfb87bc62b426a2798fde6 (patch)
tree46fbe510d32af730615fa8c7520d7c34d75d8be8 /tests
parente6003f466e6f5b7eddd01740666230b62ab5a872 (diff)
downloadmicropython-7839b8b827199ce593bfb87bc62b426a2798fde6.tar.gz
micropython-7839b8b827199ce593bfb87bc62b426a2798fde6.zip
tests/micropython/heapalloc_iter: Add tests for contains and unpack.
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/heapalloc_iter.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/micropython/heapalloc_iter.py b/tests/micropython/heapalloc_iter.py
index 3315d78c38..e1ed3daa3b 100644
--- a/tests/micropython/heapalloc_iter.py
+++ b/tests/micropython/heapalloc_iter.py
@@ -25,6 +25,22 @@ fs = frozenset((1,))
g1 = (100 + x for x in range(2))
g2 = gen_func()
+# test containment (both success and failure) with the heap locked
+heap_lock()
+print(49 in b'123', 255 in b'123')
+print(1 in t, -1 in t)
+print(1 in l, -1 in l)
+print(1 in d, -1 in d)
+print(1 in s, -1 in s)
+heap_unlock()
+
+# test unpacking with the heap locked
+unp0 = unp1 = unp2 = None # preallocate slots for globals
+heap_lock()
+unp0, unp1, unp2 = t
+print(unp0, unp1, unp2)
+heap_unlock()
+
# test certain builtins with the heap locked
heap_lock()
print(all(t))