test_files.py — anthropic-sdk-python Source File
Architecture documentation for test_files.py, a python file in the anthropic-sdk-python codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5edc302f_1734_54cf_84f0_f1b7e5105ca5["test_files.py"] 525f4270_cbfe_512c_fbe4_e6566e0cdf13["pathlib"] 5edc302f_1734_54cf_84f0_f1b7e5105ca5 --> 525f4270_cbfe_512c_fbe4_e6566e0cdf13 40396b02_9c68_4765_9e00_db68fce91470["anyio"] 5edc302f_1734_54cf_84f0_f1b7e5105ca5 --> 40396b02_9c68_4765_9e00_db68fce91470 cde8421b_93c7_41e4_d69d_2a3f1bade2f2["pytest"] 5edc302f_1734_54cf_84f0_f1b7e5105ca5 --> cde8421b_93c7_41e4_d69d_2a3f1bade2f2 9b351aef_8a05_2ff1_e2f4_32ecb0f56b14["dirty_equals"] 5edc302f_1734_54cf_84f0_f1b7e5105ca5 --> 9b351aef_8a05_2ff1_e2f4_32ecb0f56b14 188dc561_971b_83fa_1a63_8a9d302e5015["anthropic._files"] 5edc302f_1734_54cf_84f0_f1b7e5105ca5 --> 188dc561_971b_83fa_1a63_8a9d302e5015 style 5edc302f_1734_54cf_84f0_f1b7e5105ca5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from pathlib import Path
import anyio
import pytest
from dirty_equals import IsDict, IsList, IsBytes, IsTuple
from anthropic._files import to_httpx_files, async_to_httpx_files
readme_path = Path(__file__).parent.parent.joinpath("README.md")
def test_pathlib_includes_file_name() -> None:
result = to_httpx_files({"file": readme_path})
print(result)
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
def test_tuple_input() -> None:
result = to_httpx_files([("file", readme_path)])
print(result)
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
@pytest.mark.asyncio
async def test_async_pathlib_includes_file_name() -> None:
result = await async_to_httpx_files({"file": readme_path})
print(result)
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
@pytest.mark.asyncio
async def test_async_supports_anyio_path() -> None:
result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
print(result)
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
@pytest.mark.asyncio
async def test_async_tuple_input() -> None:
result = await async_to_httpx_files([("file", readme_path)])
print(result)
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
def test_string_not_allowed() -> None:
with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
to_httpx_files(
{
"file": "foo", # type: ignore
}
)
Domain
Subdomains
Functions
Dependencies
- anthropic._files
- anyio
- dirty_equals
- pathlib
- pytest
Source
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, AsyncAPI subdomain.
What functions are defined in test_files.py?
test_files.py defines 6 function(s): test_async_pathlib_includes_file_name, test_async_supports_anyio_path, test_async_tuple_input, test_pathlib_includes_file_name, test_string_not_allowed, test_tuple_input.
What does test_files.py depend on?
test_files.py imports 5 module(s): anthropic._files, anyio, dirty_equals, pathlib, pytest.
Where is test_files.py in the architecture?
test_files.py is located at tests/test_files.py (domain: AnthropicClient, subdomain: AsyncAPI, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free