mirror of
https://github.com/micropython/micropython.git
synced 2025-09-06 01:40:34 +02:00
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>
23 lines
348 B
Python
23 lines
348 B
Python
# Make sure that write operations on io.BytesIO don't
|
|
# change original object it was constructed from.
|
|
|
|
try:
|
|
import io
|
|
except ImportError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
b = b"foobar"
|
|
|
|
a = io.BytesIO(b)
|
|
a.write(b"1")
|
|
print(b)
|
|
print(a.getvalue())
|
|
|
|
b = bytearray(b"foobar")
|
|
|
|
a = io.BytesIO(b)
|
|
a.write(b"1")
|
|
print(b)
|
|
print(a.getvalue())
|