Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/basics/io_bytesio_ext2.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
283 B
Python
Raw Normal View History

tests: Replace umodule with module everywhere. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 16:57:45 +10:00
import io
py/stream: seek: Consistently handle negative offset for SEEK_SET. Per POSIX, this is EINVAL, so raises OSError(EINVAL).
2017-08-20 21:57:36 +03:00
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).
tests/io/bytesio_ext2: Remove dependency on specific EINVAL value If MICROPY_USE_INTERNAL_ERRNO is disabled, MP_EINVAL is not guaranteed to have the value 22, so we cannot depend on OSError(22,). Instead, to support any given port's errno values, without relying on uerrno, we just check that the args[0] is positive.
2018-04-30 20:59:23 -05:00
print(type(e), e.args[0] > 0)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 146ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API