test_client_utils.py — langchain Source File
Architecture documentation for test_client_utils.py, a python file in the langchain codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b9128f6f_119f_7a08_4215_fdbfd9603e9e["test_client_utils.py"] 5e7755c1_f613_0510_f115_a1e434764d9f["langchain_anthropic._client_utils"] b9128f6f_119f_7a08_4215_fdbfd9603e9e --> 5e7755c1_f613_0510_f115_a1e434764d9f style b9128f6f_119f_7a08_4215_fdbfd9603e9e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Test client utility functions."""
from __future__ import annotations
from langchain_anthropic._client_utils import (
_get_default_async_httpx_client,
_get_default_httpx_client,
)
def test_sync_client_without_proxy() -> None:
"""Test sync client creation without proxy."""
client = _get_default_httpx_client(base_url="https://api.anthropic.com")
# Should not have proxy configured
assert not hasattr(client, "proxies") or client.proxies is None
def test_sync_client_with_proxy() -> None:
"""Test sync client creation with proxy."""
proxy_url = "http://proxy.example.com:8080"
client = _get_default_httpx_client(
base_url="https://api.anthropic.com", anthropic_proxy=proxy_url
)
# Check internal _transport since httpx stores proxy configuration in the transport
# layer
transport = getattr(client, "_transport", None)
assert transport is not None
def test_async_client_without_proxy() -> None:
"""Test async client creation without proxy."""
client = _get_default_async_httpx_client(base_url="https://api.anthropic.com")
assert not hasattr(client, "proxies") or client.proxies is None
def test_async_client_with_proxy() -> None:
"""Test async client creation with proxy."""
proxy_url = "http://proxy.example.com:8080"
client = _get_default_async_httpx_client(
base_url="https://api.anthropic.com", anthropic_proxy=proxy_url
)
transport = getattr(client, "_transport", None)
assert transport is not None
def test_client_proxy_none_value() -> None:
"""Test that explicitly passing None for proxy works correctly."""
sync_client = _get_default_httpx_client(
base_url="https://api.anthropic.com", anthropic_proxy=None
)
async_client = _get_default_async_httpx_client(
base_url="https://api.anthropic.com", anthropic_proxy=None
)
# Both should be created successfully with None proxy
assert sync_client is not None
assert async_client is not None
Domain
Subdomains
Functions
Dependencies
- langchain_anthropic._client_utils
Source
Frequently Asked Questions
What does test_client_utils.py do?
test_client_utils.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_client_utils.py?
test_client_utils.py defines 5 function(s): test_async_client_with_proxy, test_async_client_without_proxy, test_client_proxy_none_value, test_sync_client_with_proxy, test_sync_client_without_proxy.
What does test_client_utils.py depend on?
test_client_utils.py imports 1 module(s): langchain_anthropic._client_utils.
Where is test_client_utils.py in the architecture?
test_client_utils.py is located at libs/partners/anthropic/tests/unit_tests/test_client_utils.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/partners/anthropic/tests/unit_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free