Home / Function/ test_adds_system_prompt_when_none_exists_async() — langchain Function Reference

test_adds_system_prompt_when_none_exists_async() — langchain Function Reference

Architecture documentation for the test_adds_system_prompt_when_none_exists_async() function in test_todo.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  84dd332b_3855_a96c_a601_a6d042a39c08["test_adds_system_prompt_when_none_exists_async()"]
  d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"]
  84dd332b_3855_a96c_a601_a6d042a39c08 -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010
  985809c4_2504_4ccb_3f22_07707d600f19["_make_request()"]
  84dd332b_3855_a96c_a601_a6d042a39c08 -->|calls| 985809c4_2504_4ccb_3f22_07707d600f19
  style 84dd332b_3855_a96c_a601_a6d042a39c08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 447–466

async def test_adds_system_prompt_when_none_exists_async() -> None:
    """Test async version - middleware adds system prompt when request has none."""
    middleware = TodoListMiddleware()
    request = _make_request(system_prompt=None)

    captured_request = None

    async def mock_handler(req: ModelRequest) -> ModelResponse:
        nonlocal captured_request
        captured_request = req
        return ModelResponse(result=[AIMessage(content="response")])

    await middleware.awrap_model_call(request, mock_handler)

    # System prompt should be set in the modified request passed to handler
    assert captured_request is not None
    assert captured_request.system_prompt is not None
    assert "write_todos" in captured_request.system_prompt
    # Original request should be unchanged
    assert request.system_prompt is None

Domain

Subdomains

Frequently Asked Questions

What does test_adds_system_prompt_when_none_exists_async() do?
test_adds_system_prompt_when_none_exists_async() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py.
Where is test_adds_system_prompt_when_none_exists_async() defined?
test_adds_system_prompt_when_none_exists_async() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 447.
What does test_adds_system_prompt_when_none_exists_async() call?
test_adds_system_prompt_when_none_exists_async() calls 1 function(s): _make_request.

Analyze Your Own Codebase

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

Try Supermodel Free