TestFiles Class — anthropic-sdk-python Architecture
Architecture documentation for the TestFiles class in test_files.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 742e4597_130d_e0c6_61cc_bc987186ac85["TestFiles"] b2269e94_16cc_4382_99bc_53ebe651cc2c["DeletedFile"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|extends| b2269e94_16cc_4382_99bc_53ebe651cc2c 05ceaa32_22bc_1d4b_0106_148d5206e33f["BinaryAPIResponse"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|extends| 05ceaa32_22bc_1d4b_0106_148d5206e33f 1e05fa32_6973_27e0_169a_cacbee0b3fd7["StreamedBinaryAPIResponse"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|extends| 1e05fa32_6973_27e0_169a_cacbee0b3fd7 d5b3e2b7_9e6b_8876_bc74_3b93a9ea11e5["FileMetadata"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|extends| d5b3e2b7_9e6b_8876_bc74_3b93a9ea11e5 77116c0e_54b9_67e7_5819_f7c2a135ea20["test_files.py"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|defined in| 77116c0e_54b9_67e7_5819_f7c2a135ea20 c9c97fce_cb59_201d_bcc1_f7d6e2440fb6["test_method_list()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| c9c97fce_cb59_201d_bcc1_f7d6e2440fb6 e8205ce1_c194_337e_2761_25edc4caf693["test_method_list_with_all_params()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| e8205ce1_c194_337e_2761_25edc4caf693 24efa8a7_27eb_1bbf_b882_9a12aab6a286["test_raw_response_list()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| 24efa8a7_27eb_1bbf_b882_9a12aab6a286 358cc0ce_9d7a_9199_bf96_489c55978d88["test_streaming_response_list()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| 358cc0ce_9d7a_9199_bf96_489c55978d88 250ad4fd_bbd5_b32e_2702_3cbb922c8ebd["test_method_delete()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| 250ad4fd_bbd5_b32e_2702_3cbb922c8ebd 2957ab69_57fe_b9d5_6d00_e405df365236["test_method_delete_with_all_params()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| 2957ab69_57fe_b9d5_6d00_e405df365236 30675b11_60f7_174c_ca27_565d74d8301c["test_raw_response_delete()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| 30675b11_60f7_174c_ca27_565d74d8301c e9e1ca21_b82f_4abe_ade7_ad1a80ee12d1["test_streaming_response_delete()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| e9e1ca21_b82f_4abe_ade7_ad1a80ee12d1 f3c8f93a_eb94_a842_f165_f50d8b95576c["test_path_params_delete()"] 742e4597_130d_e0c6_61cc_bc987186ac85 -->|method| f3c8f93a_eb94_a842_f165_f50d8b95576c
Relationship Graph
Source Code
tests/api_resources/beta/test_files.py lines 28–266
class TestFiles:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
def test_method_list(self, client: Anthropic) -> None:
file = client.beta.files.list()
assert_matches_type(SyncPage[FileMetadata], file, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Anthropic) -> None:
file = client.beta.files.list(
after_id="after_id",
before_id="before_id",
limit=1,
betas=["string"],
)
assert_matches_type(SyncPage[FileMetadata], file, path=["response"])
@parametrize
def test_raw_response_list(self, client: Anthropic) -> None:
response = 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(SyncPage[FileMetadata], file, path=["response"])
@parametrize
def test_streaming_response_list(self, client: Anthropic) -> None:
with 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 = response.parse()
assert_matches_type(SyncPage[FileMetadata], file, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
def test_method_delete(self, client: Anthropic) -> None:
file = client.beta.files.delete(
file_id="file_id",
)
assert_matches_type(DeletedFile, file, path=["response"])
@parametrize
def test_method_delete_with_all_params(self, client: Anthropic) -> None:
file = client.beta.files.delete(
file_id="file_id",
betas=["string"],
)
assert_matches_type(DeletedFile, file, path=["response"])
@parametrize
def test_raw_response_delete(self, client: Anthropic) -> None:
response = 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
def test_streaming_response_delete(self, client: Anthropic) -> None:
with 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 = response.parse()
assert_matches_type(DeletedFile, file, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
def test_path_params_delete(self, client: Anthropic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
client.beta.files.with_raw_response.delete(
Domain
Defined In
Source
Frequently Asked Questions
What is the TestFiles class?
TestFiles is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_files.py.
Where is TestFiles defined?
TestFiles is defined in tests/api_resources/beta/test_files.py at line 28.
What does TestFiles extend?
TestFiles extends DeletedFile, BinaryAPIResponse, StreamedBinaryAPIResponse, FileMetadata.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free