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

test_basic_union_response() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  4aa9ff8c_9c28_3a68_922c_f6edd5455c15["test_basic_union_response()"]
  9bf4cfe0_e3b0_70de_25ac_2113c8918900["TestAsyncAnthropic"]
  4aa9ff8c_9c28_3a68_922c_f6edd5455c15 -->|defined in| 9bf4cfe0_e3b0_70de_25ac_2113c8918900
  6668f744_5119_42ed_521c_84d03c46ec74["test_basic_union_response()"]
  6668f744_5119_42ed_521c_84d03c46ec74 -->|calls| 4aa9ff8c_9c28_3a68_922c_f6edd5455c15
  6668f744_5119_42ed_521c_84d03c46ec74["test_basic_union_response()"]
  4aa9ff8c_9c28_3a68_922c_f6edd5455c15 -->|calls| 6668f744_5119_42ed_521c_84d03c46ec74
  style 4aa9ff8c_9c28_3a68_922c_f6edd5455c15 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_client.py lines 1613–1624

    async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncAnthropic) -> None:
        class Model1(BaseModel):
            name: str

        class Model2(BaseModel):
            foo: str

        respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"}))

        response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2]))
        assert isinstance(response, Model2)
        assert response.foo == "bar"

Subdomains

Frequently Asked Questions

What does test_basic_union_response() do?
test_basic_union_response() is a function in the anthropic-sdk-python codebase, defined in tests/test_client.py.
Where is test_basic_union_response() defined?
test_basic_union_response() is defined in tests/test_client.py at line 1613.
What does test_basic_union_response() call?
test_basic_union_response() calls 1 function(s): test_basic_union_response.
What calls test_basic_union_response()?
test_basic_union_response() is called by 1 function(s): test_basic_union_response.

Analyze Your Own Codebase

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

Try Supermodel Free