io_iobase.py 343 B

12345678910111213141516171819
  1. try:
  2. import uio as io
  3. except:
  4. import io
  5. try:
  6. io.IOBase
  7. except AttributeError:
  8. print('SKIP')
  9. raise SystemExit
  10. class MyIO(io.IOBase):
  11. def write(self, buf):
  12. # CPython and uPy pass in different types for buf (str vs bytearray)
  13. print('write', len(buf))
  14. return len(buf)
  15. print('test', file=MyIO())