async def test_subscription_errors_continue(ws: WebSocketClient):
    """Verify that an ExecutionResult with errors during subscription does not terminate
    the subscription.
    """
    process_errors = Mock()
    with patch.object(Schema, "process_errors", process_errors):
        await ws.send_message(
            {
                "id": "sub1",
                "type": "subscribe",
                "payload": {
                    "query": "subscription { flavorsInvalid }",
                },
            }
        )

        next_message1: NextMessage = await ws.receive_json()
        assert next_message1["type"] == "next"
        assert next_message1["id"] == "sub1"
        assert "data" in next_message1["payload"]
        assert next_message1["payload"]["data"] == {"flavorsInvalid": "VANILLA"}

        next_message2: NextMessage = await ws.receive_json()
        assert next_message2["type"] == "next"
        assert next_message2["id"] == "sub1"
        assert "data" in next_message2["payload"]
        assert next_message2["payload"]["data"] is None
        assert "errors" in next_message2["payload"]
        assert "cannot represent value" in str(next_message2["payload"]["errors"])
        process_errors.assert_called_once()

        next_message3: NextMessage = await ws.receive_json()
        assert next_message3["type"] == "next"
        assert next_message3["id"] == "sub1"
        assert "data" in next_message3["payload"]
        assert next_message3["payload"]["data"] == {"flavorsInvalid": "CHOCOLATE"}

        complete_message: CompleteMessage = await ws.receive_json()
        assert complete_message["type"] == "complete"
        assert complete_message["id"] == "sub1"
Verify that an ExecutionResult with errors during subscription does not terminate
    the subscription.
    
tests/websockets/test_graphql_transport_ws.py