Home / Function/ test_mixed_sync_async_decorators() — langchain Function Reference

test_mixed_sync_async_decorators() — langchain Function Reference

Architecture documentation for the test_mixed_sync_async_decorators() function in test_decorators.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b94ce551_2a1c_4b68_8c26_161c8363ff80["test_mixed_sync_async_decorators()"]
  85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"]
  b94ce551_2a1c_4b68_8c26_161c8363ff80 -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4
  68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b["before_model()"]
  b94ce551_2a1c_4b68_8c26_161c8363ff80 -->|calls| 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b
  style b94ce551_2a1c_4b68_8c26_161c8363ff80 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 320–349

def test_mixed_sync_async_decorators() -> None:
    """Test decorators with both sync and async functions."""

    @before_model(name="MixedBeforeModel")
    def sync_before(*_args: Any, **_kwargs: Any) -> None:
        return None

    @before_model(name="MixedBeforeModel")
    async def async_before(*_args: Any, **_kwargs: Any) -> None:
        return None

    @wrap_model_call(name="MixedOnModelCall")
    def sync_on_call(
        request: ModelRequest,
        handler: Callable[[ModelRequest], ModelResponse],
    ) -> ModelCallResult:
        return handler(request)

    @wrap_model_call(name="MixedOnModelCall")
    async def async_on_call(
        request: ModelRequest,
        handler: Callable[[ModelRequest], Awaitable[ModelResponse]],
    ) -> ModelCallResult:
        return await handler(request)

    # Both should create valid middleware instances
    assert isinstance(sync_before, AgentMiddleware)
    assert isinstance(async_before, AgentMiddleware)
    assert isinstance(sync_on_call, AgentMiddleware)
    assert isinstance(async_on_call, AgentMiddleware)

Domain

Subdomains

Frequently Asked Questions

What does test_mixed_sync_async_decorators() do?
test_mixed_sync_async_decorators() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py.
Where is test_mixed_sync_async_decorators() defined?
test_mixed_sync_async_decorators() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 320.
What does test_mixed_sync_async_decorators() call?
test_mixed_sync_async_decorators() calls 1 function(s): before_model.

Analyze Your Own Codebase

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

Try Supermodel Free