Home / Function/ test_multiple_variants() — anthropic-sdk-python Function Reference

test_multiple_variants() — anthropic-sdk-python Function Reference

Architecture documentation for the test_multiple_variants() function in test_required_args.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  812cca46_07e8_e1ce_696d_6cfac3ac1b71["test_multiple_variants()"]
  a9d2f3dc_69b2_2afa_7833_2678e5a5db71["test_required_args.py"]
  812cca46_07e8_e1ce_696d_6cfac3ac1b71 -->|defined in| a9d2f3dc_69b2_2afa_7833_2678e5a5db71
  style 812cca46_07e8_e1ce_696d_6cfac3ac1b71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_required_args.py lines 71–86

def test_multiple_variants() -> None:
    @required_args(["a"], ["b"])
    def foo(*, a: str | None = None, b: str | None = None) -> str | None:
        return a if a is not None else b

    assert foo(a="foo") == "foo"
    assert foo(b="bar") == "bar"
    assert foo(a=None) is None
    assert foo(b=None) is None

    # TODO: this error message could probably be improved
    with pytest.raises(
        TypeError,
        match=r"Missing required arguments; Expected either \('a'\) or \('b'\) arguments to be given",
    ):
        foo()

Subdomains

Frequently Asked Questions

What does test_multiple_variants() do?
test_multiple_variants() is a function in the anthropic-sdk-python codebase, defined in tests/test_required_args.py.
Where is test_multiple_variants() defined?
test_multiple_variants() is defined in tests/test_required_args.py at line 71.

Analyze Your Own Codebase

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

Try Supermodel Free