TestAsyncAnthropicFoundry Class — anthropic-sdk-python Architecture
Architecture documentation for the TestAsyncAnthropicFoundry class in test_azure.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD c3efad89_3ca5_2277_442f_f2552a2c3fbc["TestAsyncAnthropicFoundry"] 010e17e5_4eab_021f_d798_ecbf0066bdc8["test_azure.py"] c3efad89_3ca5_2277_442f_f2552a2c3fbc -->|defined in| 010e17e5_4eab_021f_d798_ecbf0066bdc8 cbdd7287_26cf_9961_7469_28cec6ed9dae["test_basic_initialization_with_api_key()"] c3efad89_3ca5_2277_442f_f2552a2c3fbc -->|method| cbdd7287_26cf_9961_7469_28cec6ed9dae dd4ea791_f167_3d1d_acc2_6bddb5ed1f3a["test_async_azure_ad_token_provider()"] c3efad89_3ca5_2277_442f_f2552a2c3fbc -->|method| dd4ea791_f167_3d1d_acc2_6bddb5ed1f3a 76304a91_acad_7376_e48d_f1a11e0d45d0["test_initialization_from_environment_variables()"] c3efad89_3ca5_2277_442f_f2552a2c3fbc -->|method| 76304a91_acad_7376_e48d_f1a11e0d45d0
Relationship Graph
Source Code
tests/lib/test_azure.py lines 69–106
class TestAsyncAnthropicFoundry:
@pytest.mark.asyncio
async def test_basic_initialization_with_api_key(self) -> None:
"""Test basic async client initialization with API key."""
client = AsyncAnthropicFoundry(
api_key="test-key",
resource="example-resource",
)
assert client.api_key == "test-key"
assert str(client.base_url) == "https://example-resource.services.ai.azure.com/anthropic/"
@pytest.mark.asyncio
async def test_async_azure_ad_token_provider(self) -> None:
"""Test async client with async Azure AD token provider."""
async def async_token_provider() -> str:
return "async-test-token"
client = AsyncAnthropicFoundry(
azure_ad_token_provider=async_token_provider,
resource="example-resource",
)
token = await client._get_azure_ad_token()
assert token == "async-test-token"
@pytest.mark.asyncio
async def test_initialization_from_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
"""Test async client initialization falls back to environment variables."""
monkeypatch.setenv("ANTHROPIC_FOUNDRY_API_KEY", "env-key")
monkeypatch.setenv("ANTHROPIC_API_VERSION", "2023-06-01")
monkeypatch.setenv("ANTHROPIC_FOUNDRY_RESOURCE", "env-resource")
client = AsyncAnthropicFoundry()
assert client.api_key == "env-key"
assert "env-resource.services.ai.azure.com" in str(client.base_url)
Defined In
Source
Frequently Asked Questions
What is the TestAsyncAnthropicFoundry class?
TestAsyncAnthropicFoundry is a class in the anthropic-sdk-python codebase, defined in tests/lib/test_azure.py.
Where is TestAsyncAnthropicFoundry defined?
TestAsyncAnthropicFoundry is defined in tests/lib/test_azure.py at line 69.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free