diff options
Diffstat (limited to 'tests/basics/io_bytesio_ext2.py')
-rw-r--r-- | tests/basics/io_bytesio_ext2.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/basics/io_bytesio_ext2.py b/tests/basics/io_bytesio_ext2.py new file mode 100644 index 0000000000..8f624fd58c --- /dev/null +++ b/tests/basics/io_bytesio_ext2.py @@ -0,0 +1,13 @@ +try: + import uio as io +except ImportError: + import io + +a = io.BytesIO(b"foobar") +try: + a.seek(-10) +except Exception as e: + # CPython throws ValueError, but MicroPython has consistent stream + # interface, so BytesIO raises the same error as a real file, which + # is OSError(EINVAL). + print(type(e), e.args[0] > 0) |