MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_str

Method test_str

tests/test_exceptions.py:12–204  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10
11class ExceptionsTests(unittest.TestCase):
12 def test_str(self):
13 for exception, exception_str in [
14 (
15 WebSocketException("something went wrong"),
16 "something went wrong",
17 ),
18 (
19 ConnectionClosed(
20 Close(CloseCode.NORMAL_CLOSURE, ""),
21 Close(CloseCode.NORMAL_CLOSURE, ""),
22 True,
23 ),
24 "received 1000 (OK); then sent 1000 (OK)",
25 ),
26 (
27 ConnectionClosed(
28 Close(CloseCode.GOING_AWAY, "Bye!"),
29 Close(CloseCode.GOING_AWAY, "Bye!"),
30 False,
31 ),
32 "sent 1001 (going away) Bye!; then received 1001 (going away) Bye!",
33 ),
34 (
35 ConnectionClosed(
36 Close(CloseCode.NORMAL_CLOSURE, "race"),
37 Close(CloseCode.NORMAL_CLOSURE, "cond"),
38 True,
39 ),
40 "received 1000 (OK) race; then sent 1000 (OK) cond",
41 ),
42 (
43 ConnectionClosed(
44 Close(CloseCode.NORMAL_CLOSURE, "cond"),
45 Close(CloseCode.NORMAL_CLOSURE, "race"),
46 False,
47 ),
48 "sent 1000 (OK) race; then received 1000 (OK) cond",
49 ),
50 (
51 ConnectionClosed(
52 None,
53 Close(CloseCode.MESSAGE_TOO_BIG, ""),
54 None,
55 ),
56 "sent 1009 (message too big); no close frame received",
57 ),
58 (
59 ConnectionClosed(
60 Close(CloseCode.PROTOCOL_ERROR, ""),
61 None,
62 None,
63 ),
64 "received 1002 (protocol error); no close frame sent",
65 ),
66 (
67 ConnectionClosedOK(
68 Close(CloseCode.NORMAL_CLOSURE, ""),
69 Close(CloseCode.NORMAL_CLOSURE, ""),

Callers

nothing calls this directly

Calls 15

CloseClass · 0.90
ResponseClass · 0.90
HeadersClass · 0.90
WebSocketExceptionClass · 0.85
ConnectionClosedClass · 0.85
ConnectionClosedOKClass · 0.85
InvalidURIClass · 0.85
InvalidProxyClass · 0.85
InvalidHandshakeClass · 0.85
SecurityErrorClass · 0.85
ProxyErrorClass · 0.85

Tested by

no test coverage detected