2121from graphql_server .subscriptions .protocols .graphql_ws import types as ws_types
2222
2323if TYPE_CHECKING :
24- from collections .abc import AsyncIterator
25- from types import TracebackType
26- from typing_extensions import Self
24+ from collections .abc import AsyncIterator # pragma: no cover
25+ from types import TracebackType # pragma: no cover
26+ from typing_extensions import Self # pragma: no cover
2727
28- from asgiref .typing import ASGIApplication
28+ from asgiref .typing import ASGIApplication # pragma: no cover
2929
3030
3131class GraphQLWebsocketCommunicator (WebsocketCommunicator ):
@@ -71,7 +71,7 @@ def __init__(
7171 subprotocols: an ordered list of preferred subprotocols to be sent to the server.
7272 **kwargs: additional arguments to be passed to the `WebsocketCommunicator` constructor.
7373 """
74- if connection_params is None :
74+ if connection_params is None : # pragma: no cover - tested via custom initialisation
7575 connection_params = {}
7676 self .protocol = protocol
7777 subprotocols = kwargs .get ("subprotocols" , [])
@@ -139,7 +139,7 @@ async def subscribe(
139139 },
140140 }
141141
142- if variables is not None :
142+ if variables is not None : # pragma: no cover - exercised in higher-level tests
143143 start_message ["payload" ]["variables" ] = variables
144144
145145 await self .send_json_to (start_message )
@@ -155,7 +155,7 @@ async def subscribe(
155155 ret .errors = self .process_errors (payload .get ("errors" ) or [])
156156 ret .extensions = payload .get ("extensions" , None )
157157 yield ret
158- elif message ["type" ] == "error" :
158+ elif message ["type" ] == "error" : # pragma: no cover - network failures untested
159159 error_payload = message ["payload" ]
160160 yield ExecutionResult (
161161 data = None , errors = self .process_errors (error_payload )
0 commit comments