micropython: add micropython component
This commit is contained in:
19
components/language/micropython/tests/basics/io_iobase.py
Normal file
19
components/language/micropython/tests/basics/io_iobase.py
Normal file
@@ -0,0 +1,19 @@
|
||||
try:
|
||||
import uio as io
|
||||
except:
|
||||
import io
|
||||
|
||||
try:
|
||||
io.IOBase
|
||||
except AttributeError:
|
||||
print('SKIP')
|
||||
raise SystemExit
|
||||
|
||||
|
||||
class MyIO(io.IOBase):
|
||||
def write(self, buf):
|
||||
# CPython and uPy pass in different types for buf (str vs bytearray)
|
||||
print('write', len(buf))
|
||||
return len(buf)
|
||||
|
||||
print('test', file=MyIO())
|
Reference in New Issue
Block a user