PythonExtra/tests/micropython/heapalloc_int_from_bytes.py

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

10 lines
307 B
Python
Raw Normal View History

# Test that int.from_bytes() for small number of bytes generates
# small int.
import micropython
micropython.heap_lock()
print(int.from_bytes(b"1", "little"))
print(int.from_bytes(b"12", "little"))
print(int.from_bytes(b"2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", "little"))
micropython.heap_unlock()