1# test handling of failed heap allocation with dict
2
3import micropython
4
5# create dict
6x = 1
7micropython.heap_lock()
8try:
9    {x: x}
10except MemoryError:
11    print("MemoryError: create dict")
12micropython.heap_unlock()
13
14# create dict view
15x = {1: 1}
16micropython.heap_lock()
17try:
18    x.items()
19except MemoryError:
20    print("MemoryError: dict.items")
21micropython.heap_unlock()
22