circuitpython/tests/basics/io_iobase.py

21 lines
344 B
Python
Raw Normal View History

2018-06-04 02:24:15 -04:00
try:
import uio as io
except:
import io
try:
io.IOBase
except AttributeError:
2021-03-15 09:57:36 -04:00
print("SKIP")
2018-06-04 02:24:15 -04:00
raise SystemExit
class MyIO(io.IOBase):
def write(self, buf):
# CPython and uPy pass in different types for buf (str vs bytearray)
2021-03-15 09:57:36 -04:00
print("write", len(buf))
2018-06-04 02:24:15 -04:00
return len(buf)
2021-03-15 09:57:36 -04:00
print("test", file=MyIO())