circuitpython/tests/micropython/heapalloc_str.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
311 B
Python
Raw Normal View History

# String operations which don't require allocation
import micropython
micropython.heap_lock()
# Concatenating empty string returns original string
b"" + b""
b"" + b"1"
b"2" + b""
"" + ""
"" + "1"
"2" + ""
# If no replacements done, returns original string
"foo".replace(",", "_")
micropython.heap_unlock()