Home / Function/ test_old_pattern_4_specific_context() — langchain Function Reference

test_old_pattern_4_specific_context() — langchain Function Reference

Architecture documentation for the test_old_pattern_4_specific_context() function in test_middleware_backwards_compat.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1aadf5ac_502c_8541_b8f7_239d8bf6f5be["test_old_pattern_4_specific_context()"]
  74d2d22f_07ae_c5bb_33c3_7da58e2da5a0["test_middleware_backwards_compat.py"]
  1aadf5ac_502c_8541_b8f7_239d8bf6f5be -->|defined in| 74d2d22f_07ae_c5bb_33c3_7da58e2da5a0
  style 1aadf5ac_502c_8541_b8f7_239d8bf6f5be fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_backwards_compat.py lines 187–199

def test_old_pattern_4_specific_context(fake_model: GenericFakeChatModel) -> None:
    """Old pattern 4: Specific context type with 2 params."""
    agent = create_agent(
        model=fake_model,
        middleware=[OldStyleMiddleware4()],
        context_schema=MyContext,
    )
    result = agent.invoke(
        {"messages": [HumanMessage(content="hi")]},
        context={"user_id": "test-user"},
    )
    assert "messages" in result
    assert len(result["messages"]) >= 1

Domain

Subdomains

Frequently Asked Questions

What does test_old_pattern_4_specific_context() do?
test_old_pattern_4_specific_context() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_backwards_compat.py.
Where is test_old_pattern_4_specific_context() defined?
test_old_pattern_4_specific_context() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_backwards_compat.py at line 187.

Analyze Your Own Codebase

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

Try Supermodel Free