Files
micropython/tests/basics/io_bytesio_ext.py
Damien George 54e6cfc6e3 tests/basics: Skip tests of io module individually using SKIP.
Instead of using a feature check.  This is more consistent with how other
optional modules are skipped.

Signed-off-by: Damien George <damien@micropython.org>
2025-08-15 00:23:16 +10:00

31 lines
422 B
Python

# Extended stream operations on io.BytesIO
try:
import io
except ImportError:
print("SKIP")
raise SystemExit
a = io.BytesIO(b"foobar")
a.seek(10)
print(a.read(10))
a = io.BytesIO()
print(a.seek(8))
a.write(b"123")
print(a.getvalue())
print(a.seek(0, 1))
print(a.seek(-1, 2))
a.write(b"0")
print(a.getvalue())
a.flush()
print(a.getvalue())
a.seek(0)
arr = bytearray(10)
print(a.readinto(arr))
print(arr)