test_copy_default_headers() — anthropic-sdk-python Function Reference
Architecture documentation for the test_copy_default_headers() function in test_vertex.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 0bf60e41_4ec6_fb08_f96a_70685170e508["test_copy_default_headers()"] 4a282b80_48ff_4ba8_f27f_bad6b030b947["TestAnthropicVertex"] 0bf60e41_4ec6_fb08_f96a_70685170e508 -->|defined in| 4a282b80_48ff_4ba8_f27f_bad6b030b947 5b63ae3a_4e38_ac0e_37dc_713b4b9db841["test_copy_default_headers()"] 5b63ae3a_4e38_ac0e_37dc_713b4b9db841 -->|calls| 0bf60e41_4ec6_fb08_f96a_70685170e508 5b63ae3a_4e38_ac0e_37dc_713b4b9db841["test_copy_default_headers()"] 0bf60e41_4ec6_fb08_f96a_70685170e508 -->|calls| 5b63ae3a_4e38_ac0e_37dc_713b4b9db841 style 0bf60e41_4ec6_fb08_f96a_70685170e508 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/test_vertex.py lines 84–120
def test_copy_default_headers(self) -> None:
client = AnthropicVertex(
base_url=base_url,
region="region",
project_id="project",
_strict_response_validation=True,
default_headers={"X-Foo": "bar"},
)
assert client.default_headers["X-Foo"] == "bar"
# does not override the already given value when not specified
copied = client.copy()
assert copied.default_headers["X-Foo"] == "bar"
# merges already given headers
copied = client.copy(default_headers={"X-Bar": "stainless"})
assert copied.default_headers["X-Foo"] == "bar"
assert copied.default_headers["X-Bar"] == "stainless"
# uses new values for any already given headers
copied = client.copy(default_headers={"X-Foo": "stainless"})
assert copied.default_headers["X-Foo"] == "stainless"
# set_default_headers
# completely overrides already set values
copied = client.copy(set_default_headers={})
assert copied.default_headers.get("X-Foo") is None
copied = client.copy(set_default_headers={"X-Bar": "Robert"})
assert copied.default_headers["X-Bar"] == "Robert"
with pytest.raises(
ValueError,
match="`default_headers` and `set_default_headers` arguments are mutually exclusive",
):
client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"})
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does test_copy_default_headers() do?
test_copy_default_headers() is a function in the anthropic-sdk-python codebase, defined in tests/lib/test_vertex.py.
Where is test_copy_default_headers() defined?
test_copy_default_headers() is defined in tests/lib/test_vertex.py at line 84.
What does test_copy_default_headers() call?
test_copy_default_headers() calls 1 function(s): test_copy_default_headers.
What calls test_copy_default_headers()?
test_copy_default_headers() is called by 1 function(s): test_copy_default_headers.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free