circuitpython/tests/basics/int_parse.py
Damien George 69dd013919 py/objint: Allow int() to parse anything with the buffer protocol.
This generalises and simplifies the code and follows CPython behaviour.

See similar change for floats in a07fc5b640.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-01 15:11:06 +10:00

13 lines
194 B
Python

# Test parsing ints.
try:
bytearray
memoryview
except NameError:
print("SKIP")
raise SystemExit
print(int(b"123"))
print(int(bytearray(b"123")))
print(int(memoryview(b"123")))