@@ -128,44 +128,44 @@ def experimental(self) -> ExperimentalServerSessionFeatures:
128128
129129 def check_client_capability (self , capability : types .ClientCapabilities ) -> bool :
130130 """Check if the client supports a specific capability."""
131- if self ._client_params is None :
131+ if self ._client_params is None : # pragma: lax no cover
132132 return False
133133
134134 client_caps = self ._client_params .capabilities
135135
136136 # Check roots capability
137- if capability .roots and not client_caps .roots :
137+ if capability .roots and not client_caps .roots : # pragma: lax no cover
138138 return False
139139 if (capability .roots and capability .roots .list_changed and
140- client_caps .roots and not client_caps .roots .list_changed ):
140+ client_caps .roots and not client_caps .roots .list_changed ): # pragma: lax no cover
141141 return False
142142
143143 # Check sampling capability
144- if capability .sampling and not client_caps .sampling :
144+ if capability .sampling and not client_caps .sampling : # pragma: lax no cover
145145 return False
146- if capability .sampling :
147- if capability .sampling .context and not client_caps .sampling .context :
146+ if capability .sampling : # pragma: lax no cover
147+ if capability .sampling .context and not client_caps .sampling .context : # pragma: lax no cover
148148 return False
149- if capability .sampling .tools and not client_caps .sampling .tools :
149+ if capability .sampling .tools and not client_caps .sampling .tools : # pragma: lax no cover
150150 return False
151151
152152 # Check elicitation capability
153- if capability .elicitation and not client_caps .elicitation :
153+ if capability .elicitation and not client_caps .elicitation : # pragma: lax no cover
154154 return False
155155
156156 # Check experimental capability
157- if capability .experimental :
158- if not client_caps .experimental :
157+ if capability .experimental : # pragma: lax no cover
158+ if not client_caps .experimental : # pragma: lax no cover
159159 return False
160- for exp_key , exp_value in capability .experimental .items ():
161- if exp_key not in client_caps .experimental or client_caps .experimental [exp_key ] != exp_value :
160+ for exp_key , exp_value in capability .experimental .items (): # pragma: lax no cover
161+ if exp_key not in client_caps .experimental or client_caps .experimental [exp_key ] != exp_value : # pragma: lax no cover
162162 return False
163163
164164 # Check tasks capability
165- if capability .tasks :
166- if not client_caps .tasks :
165+ if capability .tasks : # pragma: lax no cover
166+ if not client_caps .tasks : # pragma: lax no cover
167167 return False
168- if not check_tasks_capability (capability .tasks , client_caps .tasks ):
168+ if not check_tasks_capability (capability .tasks , client_caps .tasks ): # pragma: lax no cover
169169 return False
170170
171171 return True
@@ -214,7 +214,7 @@ async def _received_notification(self, notification: types.ClientNotification) -
214214 self ._initialization_state = InitializationState .Initialized
215215 case types .RootsListChangedNotification ():
216216 # When roots list changes, server should request updated list
217- await self .list_roots ()
217+ await self .list_roots () # pragma: no cover
218218 case _:
219219 if self ._initialization_state != InitializationState .Initialized : # pragma: no cover
220220 raise RuntimeError ("Received notification before initialization was complete" )
0 commit comments