(test_client_factory: TestClientFactory)
| 29 | |
| 30 | |
| 31 | def test_websocket_binary_json(test_client_factory: TestClientFactory) -> None: |
| 32 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 33 | websocket = WebSocket(scope, receive=receive, send=send) |
| 34 | await websocket.accept() |
| 35 | message = await websocket.receive_json(mode="binary") |
| 36 | await websocket.send_json(message, mode="binary") |
| 37 | await websocket.close() |
| 38 | |
| 39 | client = test_client_factory(app) |
| 40 | with client.websocket_connect("/123?a=abc") as websocket: |
| 41 | websocket.send_json({"test": "data"}, mode="binary") |
| 42 | data = websocket.receive_json(mode="binary") |
| 43 | assert data == {"test": "data"} |
| 44 | |
| 45 | |
| 46 | def test_websocket_ensure_unicode_on_send_json( |
nothing calls this directly
no test coverage detected