Home / Function/ test_single_write_todos_call_allowed() — langchain Function Reference

test_single_write_todos_call_allowed() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  71b2796a_e1e4_d1be_7dde_acf3b11ac691["test_single_write_todos_call_allowed()"]
  d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"]
  71b2796a_e1e4_d1be_7dde_acf3b11ac691 -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010
  51077994_451d_5d5c_62d8_c5d5b714096b["_fake_runtime()"]
  71b2796a_e1e4_d1be_7dde_acf3b11ac691 -->|calls| 51077994_451d_5d5c_62d8_c5d5b714096b
  style 71b2796a_e1e4_d1be_7dde_acf3b11ac691 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 626–649

def test_single_write_todos_call_allowed() -> None:
    """Test that a single write_todos call is allowed."""
    middleware = TodoListMiddleware()

    # Create an AI message with one write_todos tool call
    ai_message = AIMessage(
        content="I'll update the todos",
        tool_calls=[
            {
                "name": "write_todos",
                "args": {"todos": [{"content": "Task 1", "status": "pending"}]},
                "id": "call_1",
                "type": "tool_call",
            },
        ],
    )

    state: PlanningState = {"messages": [HumanMessage(content="Hello"), ai_message]}

    # Call after_model hook
    result = middleware.after_model(state, _fake_runtime())

    # Should return None (no intervention needed)
    assert result is None

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free