summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/websocket_basic.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-08-18 16:57:45 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-06-08 17:54:24 +1000
commit4216bc7d1351feb8199e4ebbff1a9598aa1c5b02 (patch)
tree5085738ef65ab377c221f290c7fa90ec2acd4d29 /tests/extmod/websocket_basic.py
parent5e50975a6dd9466afafbcd012c00078093fe1f57 (diff)
downloadmicropython-4216bc7d1351feb8199e4ebbff1a9598aa1c5b02.tar.gz
micropython-4216bc7d1351feb8199e4ebbff1a9598aa1c5b02.zip
tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/websocket_basic.py')
-rw-r--r--tests/extmod/websocket_basic.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/extmod/websocket_basic.py b/tests/extmod/websocket_basic.py
index dabdb76be1..133457784f 100644
--- a/tests/extmod/websocket_basic.py
+++ b/tests/extmod/websocket_basic.py
@@ -1,7 +1,7 @@
try:
- import uio
- import uerrno
- import uwebsocket
+ import io
+ import errno
+ import websocket
except ImportError:
print("SKIP")
raise SystemExit
@@ -9,14 +9,14 @@ except ImportError:
# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
- ws = uwebsocket.websocket(uio.BytesIO(msg))
+ ws = websocket.websocket(io.BytesIO(msg))
return ws.read(sz)
# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):
- s = uio.BytesIO()
- ws = uwebsocket.websocket(s)
+ s = io.BytesIO()
+ ws = websocket.websocket(s)
ws.write(msg)
s.seek(0)
return s.read(sz)
@@ -38,8 +38,8 @@ print(ws_write(b"pong" * 32, 132))
print(ws_read(b"\x81\x84maskmask", 4))
# close control frame
-s = uio.BytesIO(b"\x88\x00") # FRAME_CLOSE
-ws = uwebsocket.websocket(s)
+s = io.BytesIO(b"\x88\x00") # FRAME_CLOSE
+ws = websocket.websocket(s)
print(ws.read(1))
s.seek(2)
print(s.read(4))
@@ -49,15 +49,15 @@ print(ws_read(b"\x89\x00\x81\x04ping", 4)) # FRAME_PING
print(ws_read(b"\x8a\x00\x81\x04pong", 4)) # FRAME_PONG
# close method
-ws = uwebsocket.websocket(uio.BytesIO())
+ws = websocket.websocket(io.BytesIO())
ws.close()
# ioctl
-ws = uwebsocket.websocket(uio.BytesIO())
+ws = websocket.websocket(io.BytesIO())
print(ws.ioctl(8)) # GET_DATA_OPTS
print(ws.ioctl(9, 2)) # SET_DATA_OPTS
print(ws.ioctl(9))
try:
ws.ioctl(-1)
except OSError as e:
- print("ioctl: EINVAL:", e.errno == uerrno.EINVAL)
+ print("ioctl: EINVAL:", e.errno == errno.EINVAL)