circuitpython/tests/micropython/heapalloc_bytesio2.py

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

22 lines
379 B
Python
Raw Normal View History

# Creating BytesIO from immutable object should not immediately
# copy its content.
try:
2023-08-22 11:15:46 -04:00
import io
import micropython
2021-03-15 09:57:36 -04:00
micropython.mem_total
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
data = b"1234" * 256
before = micropython.mem_total()
2023-08-22 11:15:46 -04:00
buf = io.BytesIO(data)
after = micropython.mem_total()
print(after - before < len(data))