MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _FakeClientCallDetails

Class _FakeClientCallDetails

python/openshell/sandbox_test.py:157–184  ·  view source on GitHub ↗

grpc.ClientCallDetails is a NamedTuple in real gRPC; for unit tests we just need an object with the same field set and a ._replace shim.

Source from the content-addressed store, hash-verified

155
156
157class _FakeClientCallDetails:
158 """grpc.ClientCallDetails is a NamedTuple in real gRPC; for unit tests we
159 just need an object with the same field set and a ._replace shim."""
160
161 __slots__ = ("credentials", "metadata", "method", "timeout", "wait_for_ready")
162
163 def __init__(
164 self,
165 method: str = "/Test/Method",
166 timeout: float | None = None,
167 metadata: Any = None,
168 credentials: Any = None,
169 wait_for_ready: Any = None,
170 ) -> None:
171 self.method = method
172 self.timeout = timeout
173 self.metadata = metadata
174 self.credentials = credentials
175 self.wait_for_ready = wait_for_ready
176
177 def _replace(self, **kwargs: Any) -> _FakeClientCallDetails:
178 return _FakeClientCallDetails(
179 method=kwargs.get("method", self.method),
180 timeout=kwargs.get("timeout", self.timeout),
181 metadata=kwargs.get("metadata", self.metadata),
182 credentials=kwargs.get("credentials", self.credentials),
183 wait_for_ready=kwargs.get("wait_for_ready", self.wait_for_ready),
184 )
185
186
187def test_normalize_bearer_accepts_str_or_callable() -> None:

Calls

no outgoing calls