MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / _client_kwargs

Function _client_kwargs

tests/lib/test_google_cloud.py:89–99  ·  view source on GitHub ↗

When `deferred`, the project comes from ADC on the first request instead of from the arguments.

(values: dict[str, str], *, deferred: bool, monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

87
88
89def _client_kwargs(values: dict[str, str], *, deferred: bool, monkeypatch: pytest.MonkeyPatch) -> dict[str, Any]:
90 """When `deferred`, the project comes from ADC on the first request instead of from the arguments."""
91 if not deferred:
92 return {**values, "token_provider": lambda: "tok"}
93
94 project = values["project"]
95 monkeypatch.setattr(
96 "anthropic.lib.google_cloud._client._load_adc_credentials",
97 lambda: (_FakeCredentials(token="adc-token"), project),
98 )
99 return {name: value for name, value in values.items() if name != "project"}
100
101
102def _expected_urls(segments: tuple[str, str, str]) -> list[str]:

Calls 1

_FakeCredentialsClass · 0.85

Tested by

no test coverage detected