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

test_non_application_json_content_type_for_json_data() — anthropic-sdk-python Function Reference

Architecture documentation for the test_non_application_json_content_type_for_json_data() 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
  0745f78e_a26b_6c71_e909_d8d33715ddd3["test_non_application_json_content_type_for_json_data()"]
  9bf4cfe0_e3b0_70de_25ac_2113c8918900["TestAsyncAnthropic"]
  0745f78e_a26b_6c71_e909_d8d33715ddd3 -->|defined in| 9bf4cfe0_e3b0_70de_25ac_2113c8918900
  69f806f7_a8b4_de7d_49ff_0b9ba520a407["test_non_application_json_content_type_for_json_data()"]
  69f806f7_a8b4_de7d_49ff_0b9ba520a407 -->|calls| 0745f78e_a26b_6c71_e909_d8d33715ddd3
  69f806f7_a8b4_de7d_49ff_0b9ba520a407["test_non_application_json_content_type_for_json_data()"]
  0745f78e_a26b_6c71_e909_d8d33715ddd3 -->|calls| 69f806f7_a8b4_de7d_49ff_0b9ba520a407
  style 0745f78e_a26b_6c71_e909_d8d33715ddd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_client.py lines 1649–1669

    async def test_non_application_json_content_type_for_json_data(
        self, respx_mock: MockRouter, async_client: AsyncAnthropic
    ) -> None:
        """
        Response that sets Content-Type to something other than application/json but returns json data
        """

        class Model(BaseModel):
            foo: int

        respx_mock.get("/foo").mock(
            return_value=httpx.Response(
                200,
                content=json.dumps({"foo": 2}),
                headers={"Content-Type": "application/text"},
            )
        )

        response = await async_client.get("/foo", cast_to=Model)
        assert isinstance(response, Model)
        assert response.foo == 2

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free