(test_client_factory: TestClientFactory)
| 167 | |
| 168 | |
| 169 | def test_websocket_iter_text(test_client_factory: TestClientFactory) -> None: |
| 170 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 171 | websocket = WebSocket(scope, receive=receive, send=send) |
| 172 | await websocket.accept() |
| 173 | async for data in websocket.iter_text(): |
| 174 | await websocket.send_text("Message was: " + data) |
| 175 | |
| 176 | client = test_client_factory(app) |
| 177 | with client.websocket_connect("/") as websocket: |
| 178 | websocket.send_text("Hello, world!") |
| 179 | data = websocket.receive_text() |
| 180 | assert data == "Message was: Hello, world!" |
| 181 | |
| 182 | |
| 183 | def test_websocket_iter_bytes(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected