test_document_with_secret_round_trip() — langchain Function Reference
Architecture documentation for the test_document_with_secret_round_trip() function in test_secret_injection.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 035c3611_047d_b20e_0414_7de315724a24["test_document_with_secret_round_trip()"] 49998757_7899_0216_5862_4d58a200d73a["TestRoundTrip"] 035c3611_047d_b20e_0414_7de315724a24 -->|defined in| 49998757_7899_0216_5862_4d58a200d73a style 035c3611_047d_b20e_0414_7de315724a24 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/load/test_secret_injection.py lines 289–303
def test_document_with_secret_round_trip(self) -> None:
"""Verify secret-like dict in `Document` metadata is preserved."""
doc = Document(
page_content="Hello",
metadata={"data": MALICIOUS_SECRET_DICT},
)
serialized = dumpd(doc)
deserialized = load(
serialized, secrets_from_env=True, allowed_objects=[Document]
)
# The secret-like dict should be preserved as a plain dict
assert deserialized.metadata["data"] == MALICIOUS_SECRET_DICT
assert isinstance(deserialized.metadata["data"], dict)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_document_with_secret_round_trip() do?
test_document_with_secret_round_trip() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_secret_injection.py.
Where is test_document_with_secret_round_trip() defined?
test_document_with_secret_round_trip() is defined in libs/core/tests/unit_tests/load/test_secret_injection.py at line 289.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free