Home / Function/ test_hash_is_deterministic() — langchain Function Reference

test_hash_is_deterministic() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4d0b3a60_5d5a_b1e4_d5a5_e0443cc1fe4b["test_hash_is_deterministic()"]
  da5ecf8c_8ef9_2bb4_25f6_02c8c2010968["TestHashStrategy"]
  4d0b3a60_5d5a_b1e4_d5a5_e0443cc1fe4b -->|defined in| da5ecf8c_8ef9_2bb4_25f6_02c8c2010968
  style 4d0b3a60_5d5a_b1e4_d5a5_e0443cc1fe4b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py lines 310–322

    def test_hash_is_deterministic(self) -> None:
        middleware = PIIMiddleware("email", strategy="hash")

        # Same email should produce same hash
        state1 = AgentState[Any](messages=[HumanMessage("Email: test@example.com")])
        state2 = AgentState[Any](messages=[HumanMessage("Email: test@example.com")])

        result1 = middleware.before_model(state1, Runtime())
        result2 = middleware.before_model(state2, Runtime())

        assert result1 is not None
        assert result2 is not None
        assert result1["messages"][0].content == result2["messages"][0].content

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free