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

test_proxy.py — anthropic-sdk-python Source File

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

File python AnthropicClient SyncAPI 4 imports 2 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  32e0106f_0119_1e18_bbf3_61cd2f2e0a44["test_proxy.py"]
  322907bd_5bc7_58bb_8f16_04eb36d83959["operator"]
  32e0106f_0119_1e18_bbf3_61cd2f2e0a44 --> 322907bd_5bc7_58bb_8f16_04eb36d83959
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  32e0106f_0119_1e18_bbf3_61cd2f2e0a44 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"]
  32e0106f_0119_1e18_bbf3_61cd2f2e0a44 --> 37c05070_ca59_d596_7250_de9d1939227f
  d1009234_f799_7c53_7892_4262523206dd["anthropic._utils"]
  32e0106f_0119_1e18_bbf3_61cd2f2e0a44 --> d1009234_f799_7c53_7892_4262523206dd
  style 32e0106f_0119_1e18_bbf3_61cd2f2e0a44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import operator
from typing import Any
from typing_extensions import override

from anthropic._utils import LazyProxy


class RecursiveLazyProxy(LazyProxy[Any]):
    @override
    def __load__(self) -> Any:
        return self

    def __call__(self, *_args: Any, **_kwds: Any) -> Any:
        raise RuntimeError("This should never be called!")


def test_recursive_proxy() -> None:
    proxy = RecursiveLazyProxy()
    assert repr(proxy) == "RecursiveLazyProxy"
    assert str(proxy) == "RecursiveLazyProxy"
    assert dir(proxy) == []
    assert type(proxy).__name__ == "RecursiveLazyProxy"
    assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy"


def test_isinstance_does_not_error() -> None:
    class AlwaysErrorProxy(LazyProxy[Any]):
        @override
        def __load__(self) -> Any:
            raise RuntimeError("Mocking missing dependency")

    proxy = AlwaysErrorProxy()
    assert not isinstance(proxy, dict)
    assert isinstance(proxy, LazyProxy)

Subdomains

Dependencies

  • anthropic._utils
  • operator
  • typing
  • typing_extensions

Frequently Asked Questions

What does test_proxy.py do?
test_proxy.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in test_proxy.py?
test_proxy.py defines 2 function(s): test_isinstance_does_not_error, test_recursive_proxy.
What does test_proxy.py depend on?
test_proxy.py imports 4 module(s): anthropic._utils, operator, typing, typing_extensions.
Where is test_proxy.py in the architecture?
test_proxy.py is located at tests/test_utils/test_proxy.py (domain: AnthropicClient, subdomain: SyncAPI, directory: tests/test_utils).

Analyze Your Own Codebase

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

Try Supermodel Free