async def test_operation_error_no_complete(ws: WebSocketClient):
    """Test that an "error" message is not followed by "complete"."""
    # Since we don't include the operation variables,
    # the subscription will fail immediately.
    # see https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md#error
    await ws.send_message(
        {
            "id": "sub1",
            "type": "subscribe",
            "payload": {
                "query": "subscription Foo($bar: String!){ exception(message: $bar) }",
            },
        }
    )

    error_message: ErrorMessage = await ws.receive_json()
    assert error_message["type"] == "error"
    assert error_message["id"] == "sub1"

    # after an "error" message, there should be nothing more
    # sent regarding "sub1", not even a "complete".
    await ws.send_message({"type": "ping"})

    pong_message: PongMessage = await ws.receive_json(timeout=1)
    assert pong_message == {"type": "pong"}
Test that an "error" message is not followed by "complete".
tests/websockets/test_graphql_transport_ws.py