diff options
author | Damien George <damien.p.george@gmail.com> | 2018-06-04 16:24:15 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-06-12 12:29:26 +1000 |
commit | 9144b1f10c5f48a93fdb2aefa528813bd60a2f85 (patch) | |
tree | 91eab2ad9edf1581dc45c2d39eb94079f3044340 | |
parent | 565f590586e89d837db3add08b8c926560f88f8b (diff) |
tests/io: Add simple IOBase test.
-rw-r--r-- | tests/io/iobase.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/io/iobase.py b/tests/io/iobase.py new file mode 100644 index 000000000..6f554b00f --- /dev/null +++ b/tests/io/iobase.py @@ -0,0 +1,19 @@ +try: + import uio as io +except: + import io + +try: + io.IOBase +except AttributeError: + print('SKIP') + raise SystemExit + + +class MyIO(io.IOBase): + def write(self, buf): + # CPython and uPy pass in different types for buf (str vs bytearray) + print('write', len(buf)) + return len(buf) + +print('test', file=MyIO()) |