test_parse_does_not_duplicate_beta_header() — anthropic-sdk-python Function Reference
Architecture documentation for the test_parse_does_not_duplicate_beta_header() function in test_output_format_conversion.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 16254577_3a38_cef5_45d3_fc4fe069730e["test_parse_does_not_duplicate_beta_header()"] 70c1a5fc_5744_87a2_a1ec_5c24cfd5eafe["TestStructuredOutputsBetaHeader"] 16254577_3a38_cef5_45d3_fc4fe069730e -->|defined in| 70c1a5fc_5744_87a2_a1ec_5c24cfd5eafe style 16254577_3a38_cef5_45d3_fc4fe069730e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/api_resources/beta/test_output_format_conversion.py lines 456–490
def test_parse_does_not_duplicate_beta_header(self, client: Anthropic, respx_mock: MockRouter) -> None:
"""Verify .parse() doesn't duplicate structured-outputs beta if already present."""
class DataModel(BaseModel):
value: int
respx_mock.post("/v1/messages?beta=true").mock(
return_value=httpx.Response(
200,
json={
"id": "msg_123",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"text": '{"value": 42}', "type": "text"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 10, "output_tokens": 20},
},
)
)
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
client.beta.messages.parse(
max_tokens=1024,
messages=[{"role": "user", "content": "Test"}],
model="claude-sonnet-4-5",
output_format=DataModel,
betas=["structured-outputs-2025-12-15"],
)
request = respx_mock.calls.last.request
beta_header = request.headers["anthropic-beta"]
# Should only appear once
assert beta_header.count("structured-outputs-2025-12-15") == 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_parse_does_not_duplicate_beta_header() do?
test_parse_does_not_duplicate_beta_header() is a function in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_output_format_conversion.py.
Where is test_parse_does_not_duplicate_beta_header() defined?
test_parse_does_not_duplicate_beta_header() is defined in tests/api_resources/beta/test_output_format_conversion.py at line 456.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free