Home / Function/ test_misannotated_base_tool_raises_error() — langchain Function Reference

test_misannotated_base_tool_raises_error() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 140–157

def test_misannotated_base_tool_raises_error() -> None:
    """Test that a BaseTool with the incorrect typehint raises an exception."""
    with pytest.raises(SchemaAnnotationError):

        class _MisAnnotatedTool(BaseTool):
            name: str = "structured_api"
            # This would silently be ignored without the custom metaclass
            args_schema: BaseModel = _MockSchema  # type: ignore[assignment]
            description: str = "A Structured Tool"

            @override
            def _run(self, *, arg1: int, arg2: bool, arg3: dict | None = None) -> str:
                return f"{arg1} {arg2} {arg3}"

            async def _arun(
                self, *, arg1: int, arg2: bool, arg3: dict | None = None
            ) -> str:
                raise NotImplementedError

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free