MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / test_copy_default_query

Method test_copy_default_query

tests/test_client.py:136–168  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

134 client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"})
135
136 def test_copy_default_query(self) -> None:
137 client = Opencode(base_url=base_url, _strict_response_validation=True, default_query={"foo": "bar"})
138 assert _get_params(client)["foo"] == "bar"
139
140 # does not override the already given value when not specified
141 copied = client.copy()
142 assert _get_params(copied)["foo"] == "bar"
143
144 # merges already given params
145 copied = client.copy(default_query={"bar": "stainless"})
146 params = _get_params(copied)
147 assert params["foo"] == "bar"
148 assert params["bar"] == "stainless"
149
150 # uses new values for any already given headers
151 copied = client.copy(default_query={"foo": "stainless"})
152 assert _get_params(copied)["foo"] == "stainless"
153
154 # set_default_query
155
156 # completely overrides already set values
157 copied = client.copy(set_default_query={})
158 assert _get_params(copied) == {}
159
160 copied = client.copy(set_default_query={"bar": "Robert"})
161 assert _get_params(copied)["bar"] == "Robert"
162
163 with pytest.raises(
164 ValueError,
165 # TODO: update
166 match="`default_query` and `set_default_query` arguments are mutually exclusive",
167 ):
168 client.copy(set_default_query={}, default_query={"foo": "Bar"})
169
170 def test_copy_signature(self) -> None:
171 # ensure the same parameters that can be passed to the client are defined in the `.copy()` method

Callers

nothing calls this directly

Calls 3

copyMethod · 0.95
OpencodeClass · 0.90
_get_paramsFunction · 0.85

Tested by

no test coverage detected