Skip to content

Commit

Permalink
test WebSocket.__eq__ and WebSocket.__hash__
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jun 28, 2021
1 parent 297cda8 commit f276f43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_websockets.py
Expand Up @@ -368,3 +368,13 @@ async def mock_send(message):
assert websocket["type"] == "websocket"
assert dict(websocket) == {"type": "websocket", "path": "/abc/", "headers": []}
assert len(websocket) == 3

# check __eq__ and __hash__
assert websocket != WebSocket(
{"type": "websocket", "path": "/abc/", "headers": []},
receive=mock_receive,
send=mock_send,
)
assert websocket == websocket
assert websocket in {websocket}
assert {websocket} == {websocket}

0 comments on commit f276f43

Please sign in to comment.