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

test_function_with_multiple_types() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  79568418_e545_f515_f59d_aefa1dd99dce["test_function_with_multiple_types()"]
  e25ad18d_e1f6_726f_20bc_ac8e568d4e63["TestFunctionTool"]
  79568418_e545_f515_f59d_aefa1dd99dce -->|defined in| e25ad18d_e1f6_726f_20bc_ac8e568d4e63
  style 79568418_e545_f515_f59d_aefa1dd99dce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/tools/test_functions.py lines 41–77

    def test_function_with_multiple_types(self) -> None:
        """Test function schema conversion with various Python types."""

        def simple_function(
            name: str,
            age: int,
        ) -> str:
            """A simple function with basic parameter types."""
            return f"Person: {name}, {age} years old"

        function_tool = beta_tool(simple_function)

        # Test that we can create the tool and call it
        assert function_tool.name == "simple_function"
        assert function_tool.description == "A simple function with basic parameter types."

        # Test calling the function
        result = function_tool.call(
            {
                "name": "John",
                "age": 25,
            }
        )
        assert result == "Person: John, 25 years old"

        # Test schema structure
        expected_schema = {
            "additionalProperties": False,
            "type": "object",
            "properties": {
                "name": {"title": "Name", "type": "string"},
                "age": {"title": "Age", "type": "integer"},
            },
            "required": ["name", "age"],
        }

        assert function_tool.input_schema == expected_schema

Subdomains

Frequently Asked Questions

What does test_function_with_multiple_types() do?
test_function_with_multiple_types() is a function in the anthropic-sdk-python codebase, defined in tests/lib/tools/test_functions.py.
Where is test_function_with_multiple_types() defined?
test_function_with_multiple_types() is defined in tests/lib/tools/test_functions.py at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free