Home / Function/ test_decorator_async_only_raises_on_sync_path() — langchain Function Reference

test_decorator_async_only_raises_on_sync_path() — langchain Function Reference

Architecture documentation for the test_decorator_async_only_raises_on_sync_path() function in test_sync_async_wrappers.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  15d22467_7501_6df2_579f_10a86308443c["test_decorator_async_only_raises_on_sync_path()"]
  dcfb9efa_1e8c_d646_a0b4_9a9d7afddd2c["TestSyncAsyncMiddlewareComposition"]
  15d22467_7501_6df2_579f_10a86308443c -->|defined in| dcfb9efa_1e8c_d646_a0b4_9a9d7afddd2c
  style 15d22467_7501_6df2_579f_10a86308443c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py lines 462–490

    def test_decorator_async_only_raises_on_sync_path(self) -> None:
        """Decorator-created async-only middleware raises on sync path."""

        @wrap_tool_call
        async def my_async_wrapper(
            request: ToolCallRequest,
            handler: Callable[[ToolCallRequest], Awaitable[ToolMessage | Command[Any]]],
        ) -> ToolMessage | Command[Any]:
            return await handler(request)

        model = FakeToolCallingModel(
            tool_calls=[
                [ToolCall(name="search", args={"query": "test"}, id="1")],
                [],
            ]
        )

        agent = create_agent(
            model=model,
            tools=[search],
            middleware=[my_async_wrapper],
            checkpointer=InMemorySaver(),
        )

        with pytest.raises(NotImplementedError):
            agent.invoke(
                {"messages": [HumanMessage("Search")]},
                {"configurable": {"thread_id": "test"}},
            )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free