Home / Function/ test_response_parse_expect_model_union_non_json_content() — anthropic-sdk-python Function Reference

test_response_parse_expect_model_union_non_json_content() — anthropic-sdk-python Function Reference

Architecture documentation for the test_response_parse_expect_model_union_non_json_content() function in test_legacy_response.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  f1f3fcf6_adf2_40c5_d9d2_6b0696926f44["test_response_parse_expect_model_union_non_json_content()"]
  220a5d1f_6983_9c80_71b8_c5877a0fc71e["test_legacy_response.py"]
  f1f3fcf6_adf2_40c5_d9d2_6b0696926f44 -->|defined in| 220a5d1f_6983_9c80_71b8_c5877a0fc71e
  style f1f3fcf6_adf2_40c5_d9d2_6b0696926f44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_legacy_response.py lines 136–148

def test_response_parse_expect_model_union_non_json_content(client: Anthropic) -> None:
    response = LegacyAPIResponse(
        raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}),
        client=client,
        stream=False,
        stream_cls=None,
        cast_to=str,
        options=FinalRequestOptions.construct(method="get", url="/foo"),
    )

    obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel]))
    assert isinstance(obj, str)
    assert obj == "foo"

Subdomains

Frequently Asked Questions

What does test_response_parse_expect_model_union_non_json_content() do?
test_response_parse_expect_model_union_non_json_content() is a function in the anthropic-sdk-python codebase, defined in tests/test_legacy_response.py.
Where is test_response_parse_expect_model_union_non_json_content() defined?
test_response_parse_expect_model_union_non_json_content() is defined in tests/test_legacy_response.py at line 136.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free