summaryrefslogtreecommitdiff
path: root/tests/basics/io_bytesio_ext2.py
blob: f60a6a9a6041ee14f4588fefad3565ed8429832e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
try:
    import io
except ImportError:
    print("SKIP")
    raise SystemExit

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)