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

test_binary_content_upload_with_asynciterator() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  09b8c8d9_7766_f112_864c_670119a05b88["test_binary_content_upload_with_asynciterator()"]
  9bf4cfe0_e3b0_70de_25ac_2113c8918900["TestAsyncAnthropic"]
  09b8c8d9_7766_f112_864c_670119a05b88 -->|defined in| 9bf4cfe0_e3b0_70de_25ac_2113c8918900
  0a04b409_6f00_6233_5ab3_8a77351354af["_make_async_iterator()"]
  09b8c8d9_7766_f112_864c_670119a05b88 -->|calls| 0a04b409_6f00_6233_5ab3_8a77351354af
  style 09b8c8d9_7766_f112_864c_670119a05b88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_client.py lines 1563–1588

    async def test_binary_content_upload_with_asynciterator(self) -> None:
        file_content = b"Hello, this is a test file."
        counter = Counter()
        iterator = _make_async_iterator([file_content], counter=counter)

        async def mock_handler(request: httpx.Request) -> httpx.Response:
            assert counter.value == 0, "the request body should not have been read"
            return httpx.Response(200, content=await request.aread())

        async with AsyncAnthropic(
            base_url=base_url,
            api_key=api_key,
            _strict_response_validation=True,
            http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)),
        ) as client:
            response = await client.post(
                "/upload",
                content=iterator,
                cast_to=httpx.Response,
                options={"headers": {"Content-Type": "application/octet-stream"}},
            )

            assert response.status_code == 200
            assert response.request.headers["Content-Type"] == "application/octet-stream"
            assert response.content == file_content
            assert counter.value == 1

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free