(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=class="st">"binary") |
| 36 | await websocket.send_json(message, mode=class="st">"binary") |
| 37 | await websocket.close() |
| 38 | |
| 39 | client = test_client_factory(app) |
| 40 | with client.websocket_connect(class="st">"/123?a=abc") as websocket: |
| 41 | websocket.send_json({class="st">"test": class="st">"data"}, mode=class="st">"binary") |
| 42 | data = websocket.receive_json(mode=class="st">"binary") |
| 43 | assert data == {class="st">"test": class="st">"data"} |
| 44 | |
| 45 | |
| 46 | def test_websocket_ensure_unicode_on_send_json( |
nothing calls this directly
no test coverage detected