summaryrefslogtreecommitdiff
path: root/tests/basics/io_iobase.py
blob: de7e4a0b06b389fb895884b67ca827667ca9cf23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
try:
    import io

    io.IOBase
except (AttributeError, ImportError):
    print("SKIP")
    raise SystemExit


class MyIO(io.IOBase):
    def write(self, buf):
        # CPython and MicroPython pass in different types for buf (str vs bytearray)
        print('write', len(buf))
        return len(buf)

print('test', file=MyIO())