summaryrefslogtreecommitdiffstatshomepage
path: root/tests/io
diff options
context:
space:
mode:
Diffstat (limited to 'tests/io')
-rw-r--r--tests/io/bytesio_ext2.py13
-rw-r--r--tests/io/bytesio_ext2.py.exp1
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/io/bytesio_ext2.py b/tests/io/bytesio_ext2.py
new file mode 100644
index 0000000000..c07ad900c9
--- /dev/null
+++ b/tests/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(repr(e))
diff --git a/tests/io/bytesio_ext2.py.exp b/tests/io/bytesio_ext2.py.exp
new file mode 100644
index 0000000000..b52e4978aa
--- /dev/null
+++ b/tests/io/bytesio_ext2.py.exp
@@ -0,0 +1 @@
+OSError(22,)