Home / Function/ test_tool_invalid_docstrings() — langchain Function Reference

test_tool_invalid_docstrings() — langchain Function Reference

Architecture documentation for the test_tool_invalid_docstrings() function in test_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3da9101a_e1fa_ff89_62dc_2212646e5bee["test_tool_invalid_docstrings()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  3da9101a_e1fa_ff89_62dc_2212646e5bee -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  style 3da9101a_e1fa_ff89_62dc_2212646e5bee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 1359–1390

def test_tool_invalid_docstrings() -> None:
    """Test invalid docstrings."""

    def foo3(bar: str, baz: int) -> str:
        """The foo."""
        return bar

    def foo4(bar: str, baz: int) -> str:
        """The foo.
        Args:
            bar: The bar.
            baz: The baz.
        """  # noqa: D205,D411  # We're intentionally testing bad formatting.
        return bar

    for func in {foo3, foo4}:
        with pytest.raises(ValueError, match="Found invalid Google-Style docstring"):
            _ = tool(func, parse_docstring=True)

    def foo5(bar: str, baz: int) -> str:  # noqa: D417
        """The foo.

        Args:
            banana: The bar.
            monkey: The baz.
        """
        return bar

    with pytest.raises(
        ValueError, match="Arg banana in docstring not found in function signature"
    ):
        _ = tool(foo5, parse_docstring=True)

Domain

Subdomains

Frequently Asked Questions

What does test_tool_invalid_docstrings() do?
test_tool_invalid_docstrings() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_invalid_docstrings() defined?
test_tool_invalid_docstrings() is defined in libs/core/tests/unit_tests/test_tools.py at line 1359.

Analyze Your Own Codebase

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

Try Supermodel Free