Home / File/ test_files.py — anthropic-sdk-python Source File

test_files.py — anthropic-sdk-python Source File

Architecture documentation for test_files.py, a python file in the anthropic-sdk-python codebase. 11 imports, 0 dependents.

File python AnthropicClient Authentication 11 imports 2 classes

Entity Profile

Dependency Diagram

graph LR
  77116c0e_54b9_67e7_5819_f7c2a135ea20["test_files.py"]
  bb0af148_44a9_df40_49c4_0fa6ceb5a403["os"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> bb0af148_44a9_df40_49c4_0fa6ceb5a403
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  9c26e8a9_1ad2_1174_876a_1fc500ce0eaf["httpx"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> 9c26e8a9_1ad2_1174_876a_1fc500ce0eaf
  cde8421b_93c7_41e4_d69d_2a3f1bade2f2["pytest"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> cde8421b_93c7_41e4_d69d_2a3f1bade2f2
  f6010db4_1656_22a8_b4ae_e0060d80d8c6["respx"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> f6010db4_1656_22a8_b4ae_e0060d80d8c6
  d10c5377_2939_0f0b_cc44_8759393f2853["anthropic"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> d10c5377_2939_0f0b_cc44_8759393f2853
  cf46c35e_ae7e_a652_f32b_5dd703f4d658["utils.py"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> cf46c35e_ae7e_a652_f32b_5dd703f4d658
  08e9c9e7_d7f9_615f_5837_b3de69122e37["assert_matches_type"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> 08e9c9e7_d7f9_615f_5837_b3de69122e37
  ea606e9d_0e18_6912_4ea7_7d29a732350b["anthropic._response"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> ea606e9d_0e18_6912_4ea7_7d29a732350b
  7bee6b18_3397_1147_6683_6b09ec705805["anthropic.pagination"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> 7bee6b18_3397_1147_6683_6b09ec705805
  02abf1f6_b512_32df_c4f5_940df96192d8["anthropic.types.beta"]
  77116c0e_54b9_67e7_5819_f7c2a135ea20 --> 02abf1f6_b512_32df_c4f5_940df96192d8
  style 77116c0e_54b9_67e7_5819_f7c2a135ea20 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import os
from typing import Any, cast

import httpx
import pytest
from respx import MockRouter

from anthropic import Anthropic, AsyncAnthropic
from tests.utils import assert_matches_type
from anthropic._response import (
    BinaryAPIResponse,
    AsyncBinaryAPIResponse,
    StreamedBinaryAPIResponse,
    AsyncStreamedBinaryAPIResponse,
)
from anthropic.pagination import SyncPage, AsyncPage
from anthropic.types.beta import DeletedFile, FileMetadata

# pyright: reportDeprecated=false

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")


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"

// ... (450 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does test_files.py do?
test_files.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, Authentication subdomain.
What does test_files.py depend on?
test_files.py imports 11 module(s): anthropic, anthropic._response, anthropic.pagination, anthropic.types.beta, assert_matches_type, httpx, os, pytest, and 3 more.
Where is test_files.py in the architecture?
test_files.py is located at tests/api_resources/beta/test_files.py (domain: AnthropicClient, subdomain: Authentication, directory: tests/api_resources/beta).

Analyze Your Own Codebase

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

Try Supermodel Free