Home / Class/ TestAsyncFiles Class — anthropic-sdk-python Architecture

TestAsyncFiles Class — anthropic-sdk-python Architecture

Architecture documentation for the TestAsyncFiles class in test_files.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  0d4638a9_c546_5068_00a8_9c0b786b1733["TestAsyncFiles"]
  b2269e94_16cc_4382_99bc_53ebe651cc2c["DeletedFile"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|extends| b2269e94_16cc_4382_99bc_53ebe651cc2c
  bbd3ea26_8d54_610d_41cb_3ac713029b47["AsyncBinaryAPIResponse"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|extends| bbd3ea26_8d54_610d_41cb_3ac713029b47
  ff66b87c_6be7_7e75_c963_dea1a8d15297["AsyncStreamedBinaryAPIResponse"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|extends| ff66b87c_6be7_7e75_c963_dea1a8d15297
  d5b3e2b7_9e6b_8876_bc74_3b93a9ea11e5["FileMetadata"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|extends| d5b3e2b7_9e6b_8876_bc74_3b93a9ea11e5
  77116c0e_54b9_67e7_5819_f7c2a135ea20["test_files.py"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|defined in| 77116c0e_54b9_67e7_5819_f7c2a135ea20
  f3669c24_8044_ce54_cb63_ccc6c1305f99["test_method_list()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| f3669c24_8044_ce54_cb63_ccc6c1305f99
  24653e2f_b0a5_6836_d875_33c2b03ef2e1["test_method_list_with_all_params()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| 24653e2f_b0a5_6836_d875_33c2b03ef2e1
  0a4570d6_4912_1101_fc79_7ac105f9c922["test_raw_response_list()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| 0a4570d6_4912_1101_fc79_7ac105f9c922
  bf74de39_0df1_c9bb_c3f0_63af88c816fd["test_streaming_response_list()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| bf74de39_0df1_c9bb_c3f0_63af88c816fd
  eafd19b8_7396_cb1c_0110_55c4932cca97["test_method_delete()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| eafd19b8_7396_cb1c_0110_55c4932cca97
  90269159_a8db_abda_deb7_493a5cf4556f["test_method_delete_with_all_params()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| 90269159_a8db_abda_deb7_493a5cf4556f
  97b511fc_0dad_caa8_86f9_074a5d5680d8["test_raw_response_delete()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| 97b511fc_0dad_caa8_86f9_074a5d5680d8
  ff086ab4_2178_022f_d8b7_7f894254130a["test_streaming_response_delete()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| ff086ab4_2178_022f_d8b7_7f894254130a
  454b2704_ec50_0fc9_b528_1a04ebf1f5c9["test_path_params_delete()"]
  0d4638a9_c546_5068_00a8_9c0b786b1733 -->|method| 454b2704_ec50_0fc9_b528_1a04ebf1f5c9

Relationship Graph

Source Code

tests/api_resources/beta/test_files.py lines 269–509

class TestAsyncFiles:
    parametrize = pytest.mark.parametrize(
        "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
    )

    @parametrize
    async def test_method_list(self, async_client: AsyncAnthropic) -> None:
        file = await async_client.beta.files.list()
        assert_matches_type(AsyncPage[FileMetadata], file, path=["response"])

    @parametrize
    async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
        file = await async_client.beta.files.list(
            after_id="after_id",
            before_id="before_id",
            limit=1,
            betas=["string"],
        )
        assert_matches_type(AsyncPage[FileMetadata], file, path=["response"])

    @parametrize
    async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
        response = await async_client.beta.files.with_raw_response.list()

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        file = response.parse()
        assert_matches_type(AsyncPage[FileMetadata], file, path=["response"])

    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
        async with async_client.beta.files.with_streaming_response.list() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            file = await response.parse()
            assert_matches_type(AsyncPage[FileMetadata], file, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_method_delete(self, async_client: AsyncAnthropic) -> None:
        file = await async_client.beta.files.delete(
            file_id="file_id",
        )
        assert_matches_type(DeletedFile, file, path=["response"])

    @parametrize
    async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None:
        file = await async_client.beta.files.delete(
            file_id="file_id",
            betas=["string"],
        )
        assert_matches_type(DeletedFile, file, path=["response"])

    @parametrize
    async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None:
        response = await async_client.beta.files.with_raw_response.delete(
            file_id="file_id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        file = response.parse()
        assert_matches_type(DeletedFile, file, path=["response"])

    @parametrize
    async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None:
        async with async_client.beta.files.with_streaming_response.delete(
            file_id="file_id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            file = await response.parse()
            assert_matches_type(DeletedFile, file, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None:

Frequently Asked Questions

What is the TestAsyncFiles class?
TestAsyncFiles is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_files.py.
Where is TestAsyncFiles defined?
TestAsyncFiles is defined in tests/api_resources/beta/test_files.py at line 269.
What does TestAsyncFiles extend?
TestAsyncFiles extends DeletedFile, AsyncBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, FileMetadata.

Analyze Your Own Codebase

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

Try Supermodel Free