test_apply_to_tool_results_block_strategy() — langchain Function Reference
Architecture documentation for the test_apply_to_tool_results_block_strategy() function in test_pii.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 4cbd77cc_a2ca_e28c_153f_3f893dc106c9["test_apply_to_tool_results_block_strategy()"] 74acad26_e3cd_8385_fcb7_9bf787fa3f4a["TestPIIMiddlewareIntegration"] 4cbd77cc_a2ca_e28c_153f_3f893dc106c9 -->|defined in| 74acad26_e3cd_8385_fcb7_9bf787fa3f4a style 4cbd77cc_a2ca_e28c_153f_3f893dc106c9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py lines 474–495
def test_apply_to_tool_results_block_strategy(self) -> None:
"""Test that block strategy raises error for PII in tool results."""
middleware = PIIMiddleware(
"email", strategy="block", apply_to_input=False, apply_to_tool_results=True
)
state = AgentState[Any](
messages=[
HumanMessage("Search for user"),
AIMessage(
content="",
tool_calls=[ToolCall(name="search", args={}, id="call_789", type="tool_call")],
),
ToolMessage(content="User email: sensitive@example.com", tool_call_id="call_789"),
]
)
with pytest.raises(PIIDetectionError) as exc_info:
middleware.before_model(state, Runtime())
assert exc_info.value.pii_type == "email"
assert len(exc_info.value.matches) == 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_apply_to_tool_results_block_strategy() do?
test_apply_to_tool_results_block_strategy() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py.
Where is test_apply_to_tool_results_block_strategy() defined?
test_apply_to_tool_results_block_strategy() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py at line 474.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free