Home / Function/ test_block_raises_exception() — langchain Function Reference

test_block_raises_exception() — langchain Function Reference

Architecture documentation for the test_block_raises_exception() function in test_pii.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  24f999e9_9704_8e67_cf20_15013ccdc1dc["test_block_raises_exception()"]
  5ff24760_234b_79ca_abb8_c2089bbd6343["TestBlockStrategy"]
  24f999e9_9704_8e67_cf20_15013ccdc1dc -->|defined in| 5ff24760_234b_79ca_abb8_c2089bbd6343
  style 24f999e9_9704_8e67_cf20_15013ccdc1dc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py lines 328–337

    def test_block_raises_exception(self) -> None:
        middleware = PIIMiddleware("email", strategy="block")
        state = AgentState[Any](messages=[HumanMessage("Email: test@example.com")])

        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
        assert "test@example.com" in exc_info.value.matches[0]["value"]

Domain

Subdomains

Frequently Asked Questions

What does test_block_raises_exception() do?
test_block_raises_exception() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py.
Where is test_block_raises_exception() defined?
test_block_raises_exception() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py at line 328.

Analyze Your Own Codebase

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

Try Supermodel Free