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.

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_client.py lines 631–642

    def test_basic_union_response(self, respx_mock: MockRouter, client: Anthropic) -> 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 = 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 631.
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