summaryrefslogtreecommitdiffstats
path: root/lang/python/python-websocket-client/test.sh
blob: 842fb141626b790e53cd53cf9e9fc7a4593fff5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

[ "$1" = "python3-websocket-client" ] || exit 0

python3 - << EOF
import sys
import websocket

if websocket.__version__ != "$2":
    print("Wrong version: " + websocket.__version__)
    sys.exit(1)

# Verify core API is importable
from websocket import (
    WebSocket,
    WebSocketApp,
    WebSocketConnectionClosedException,
    WebSocketTimeoutException,
    WebSocketBadStatusException,
    create_connection,
    enableTrace,
)

# WebSocket can be instantiated (without connecting)
ws = WebSocket()
assert ws is not None

# WebSocketApp can be instantiated with just a URL
app = WebSocketApp("ws://localhost:9999")
assert app is not None

# Trace toggle does not raise
enableTrace(False)

sys.exit(0)
EOF