Home / Function/ test_basic_decorator_usage() — langchain Function Reference

test_basic_decorator_usage() — langchain Function Reference

Architecture documentation for the test_basic_decorator_usage() function in test_wrap_model_call.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7d62a5a9_120b_f8ce_652d_dad2e75b0134["test_basic_decorator_usage()"]
  5a3c6db0_0302_046a_d217_22fb3d4e632e["TestWrapModelCallDecorator"]
  7d62a5a9_120b_f8ce_652d_dad2e75b0134 -->|defined in| 5a3c6db0_0302_046a_d217_22fb3d4e632e
  style 7d62a5a9_120b_f8ce_652d_dad2e75b0134 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py lines 1008–1027

    def test_basic_decorator_usage(self) -> None:
        """Test basic decorator usage without parameters."""

        @wrap_model_call
        def passthrough_middleware(
            request: ModelRequest,
            handler: Callable[[ModelRequest], ModelResponse],
        ) -> ModelCallResult:
            return handler(request)

        # Should return an AgentMiddleware instance
        assert isinstance(passthrough_middleware, AgentMiddleware)

        # Should work in agent
        model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello")]))
        agent = create_agent(model=model, middleware=[passthrough_middleware])

        result = agent.invoke({"messages": [HumanMessage("Hi")]})
        assert len(result["messages"]) == 2
        assert result["messages"][1].content == "Hello"

Domain

Subdomains

Frequently Asked Questions

What does test_basic_decorator_usage() do?
test_basic_decorator_usage() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py.
Where is test_basic_decorator_usage() defined?
test_basic_decorator_usage() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py at line 1008.

Analyze Your Own Codebase

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

Try Supermodel Free