test_client.py — anthropic-sdk-python Source File
Architecture documentation for test_client.py, a python file in the anthropic-sdk-python codebase. 24 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9e5c097c_ec73_f29f_5858_a29a8c31dd98["test_client.py"] cf46c35e_ae7e_a652_f32b_5dd703f4d658["utils.py"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> cf46c35e_ae7e_a652_f32b_5dd703f4d658 ae802d41_8406_bfb9_2e71_e38e830a98da["update_env"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> ae802d41_8406_bfb9_2e71_e38e830a98da 8882b170_323b_9170_7400_d508a7431848["gc"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 8882b170_323b_9170_7400_d508a7431848 bb0af148_44a9_df40_49c4_0fa6ceb5a403["os"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> bb0af148_44a9_df40_49c4_0fa6ceb5a403 42faf450_4542_3635_bb7f_62cffcc3e979["sys"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 42faf450_4542_3635_bb7f_62cffcc3e979 28b0c811_20f6_fc4a_4b48_7fb9e87bf7e5["json"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 28b0c811_20f6_fc4a_4b48_7fb9e87bf7e5 22e54b11_c61c_96dc_bf33_dfc7151750e9["asyncio"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 22e54b11_c61c_96dc_bf33_dfc7151750e9 506d0594_2a0d_4f14_1041_ed428dcfcac8["inspect"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 506d0594_2a0d_4f14_1041_ed428dcfcac8 502bcd71_2b14_2539_b89c_b79ccebb5168["dataclasses"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 502bcd71_2b14_2539_b89c_b79ccebb5168 9677e396_9392_dd83_f5c5_a8cfbda1423c["tracemalloc"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 9677e396_9392_dd83_f5c5_a8cfbda1423c 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875 d65500d4_b114_ce5d_3ef9_aa6a05d9bb86["unittest"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> d65500d4_b114_ce5d_3ef9_aa6a05d9bb86 37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 37c05070_ca59_d596_7250_de9d1939227f 9c26e8a9_1ad2_1174_876a_1fc500ce0eaf["httpx"] 9e5c097c_ec73_f29f_5858_a29a8c31dd98 --> 9c26e8a9_1ad2_1174_876a_1fc500ce0eaf style 9e5c097c_ec73_f29f_5858_a29a8c31dd98 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 gc
import os
import sys
import json
import asyncio
import inspect
import dataclasses
import tracemalloc
from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast
from unittest import mock
from typing_extensions import Literal, AsyncIterator, override
import httpx
import pytest
from respx import MockRouter
from pydantic import ValidationError
from anthropic import Anthropic, AsyncAnthropic, APIResponseValidationError
from anthropic._types import Omit
from anthropic._utils import asyncify
from anthropic._models import BaseModel, FinalRequestOptions
from anthropic._streaming import Stream, AsyncStream
from anthropic._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
from anthropic._base_client import (
DEFAULT_TIMEOUT,
HTTPX_DEFAULT_TIMEOUT,
BaseClient,
OtherPlatform,
DefaultHttpxClient,
DefaultAsyncHttpxClient,
get_platform,
make_request_options,
)
from .utils import update_env
T = TypeVar("T")
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
api_key = "my-anthropic-api-key"
def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]:
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
url = httpx.URL(request.url)
return dict(url.params)
def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float:
return 0.1
def mirror_request_content(request: httpx.Request) -> httpx.Response:
return httpx.Response(200, content=request.content)
# note: we can't use the httpx.MockTransport class as it consumes the request
// ... (2036 more lines)
Domain
Subdomains
Functions
Dependencies
- anthropic
- anthropic._base_client
- anthropic._exceptions
- anthropic._models
- anthropic._streaming
- anthropic._types
- anthropic._utils
- asyncio
- dataclasses
- gc
- httpx
- inspect
- json
- os
- pydantic
- pytest
- respx
- sys
- tracemalloc
- typing
- typing_extensions
- unittest
- update_env
- utils.py
Source
Frequently Asked Questions
What does test_client.py do?
test_client.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, Authentication subdomain.
What functions are defined in test_client.py?
test_client.py defines 6 function(s): _get_open_connections, _get_params, _low_retry_timeout, _make_async_iterator, _make_sync_iterator, mirror_request_content.
What does test_client.py depend on?
test_client.py imports 24 module(s): anthropic, anthropic._base_client, anthropic._exceptions, anthropic._models, anthropic._streaming, anthropic._types, anthropic._utils, asyncio, and 16 more.
Where is test_client.py in the architecture?
test_client.py is located at tests/test_client.py (domain: AnthropicClient, subdomain: Authentication, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free