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

test_docstring_parsing_with_parameters() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/lib/tools/test_functions.py lines 332–370

    def test_docstring_parsing_with_parameters(self, docstring: str) -> None:
        def get_weather_detailed(location: str, unit: str = "celsius", include_forecast: bool = False) -> str:  # noqa: ARG001
            return f"Weather for {location}"

        get_weather_detailed.__doc__ = docstring

        function_tool = beta_tool(get_weather_detailed)

        expected_description = (
            "Get detailed weather information for a location.\n\n"
            "This function retrieves current weather conditions and optionally\n"
            "includes a forecast for the specified location."
        )
        expected_schema = {
            "additionalProperties": False,
            "type": "object",
            "properties": {
                "location": {
                    "title": "Location",
                    "type": "string",
                    "description": "The city or location to get weather for.",
                },
                "unit": {
                    "title": "Unit",
                    "type": "string",
                    "default": "celsius",
                    "description": "Temperature unit, either 'celsius' or 'fahrenheit'.",
                },
                "include_forecast": {
                    "title": "Include Forecast",
                    "type": "boolean",
                    "default": False,
                    "description": "Whether to include forecast data.",
                },
            },
            "required": ["location"],
        }
        assert function_tool.description == expected_description
        assert function_tool.input_schema == expected_schema

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free