Home / Function/ test_redact_email() — langchain Function Reference

test_redact_email() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  437a7f4a_3ed3_ce3f_fbf8_ab71d470e594["test_redact_email()"]
  f0334f9f_5b74_843e_1a42_a995ed9c8b18["TestRedactStrategy"]
  437a7f4a_3ed3_ce3f_fbf8_ab71d470e594 -->|defined in| f0334f9f_5b74_843e_1a42_a995ed9c8b18
  style 437a7f4a_3ed3_ce3f_fbf8_ab71d470e594 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py lines 234–242

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

        result = middleware.before_model(state, Runtime())

        assert result is not None
        assert "[REDACTED_EMAIL]" in result["messages"][0].content
        assert "test@example.com" not in result["messages"][0].content

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free