micropython/tests/io/stringio_with.py
Paul Sokolovsky 566d8f1d7e tests: Make "io" modules fixes for CPython compatibility.
Previously, "import _io" worked on both CPython and MicroPython (essentially
by a chance on CPython, as there's not guarantee that its contents will stay
the same across versions), but as the module was renamed to uio, need to use
more robust import sequence for compatibility.
2016-05-02 14:38:07 +03:00

10 lines
155 B
Python

try:
import uio as io
except ImportError:
import io
# test __enter__/__exit__
with io.StringIO() as b:
b.write("foo")
print(b.getvalue())