Home / Function/ test_document_metadata_with_nested_lc_key_escaped() — langchain Function Reference

test_document_metadata_with_nested_lc_key_escaped() — langchain Function Reference

Architecture documentation for the test_document_metadata_with_nested_lc_key_escaped() function in test_serializable.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1a2dadb3_bc1b_7714_b00d_afa1425cccfe["test_document_metadata_with_nested_lc_key_escaped()"]
  a193f10f_1a60_b879_b342_d29b1680b3e6["TestEscaping"]
  1a2dadb3_bc1b_7714_b00d_afa1425cccfe -->|defined in| a193f10f_1a60_b879_b342_d29b1680b3e6
  65e00528_4902_54e4_5ae3_b41dfdc19949["test_document_metadata_with_nested_lc_key_escaped()"]
  65e00528_4902_54e4_5ae3_b41dfdc19949 -->|calls| 1a2dadb3_bc1b_7714_b00d_afa1425cccfe
  65e00528_4902_54e4_5ae3_b41dfdc19949["test_document_metadata_with_nested_lc_key_escaped()"]
  1a2dadb3_bc1b_7714_b00d_afa1425cccfe -->|calls| 65e00528_4902_54e4_5ae3_b41dfdc19949
  style 1a2dadb3_bc1b_7714_b00d_afa1425cccfe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/load/test_serializable.py lines 425–437

    def test_document_metadata_with_nested_lc_key_escaped(self) -> None:
        """Test that nested `'lc'` key in `Document` metadata is escaped."""
        suspicious_nested = {"lc": 1, "type": "constructor", "id": ["some", "module"]}
        doc = Document(page_content="test", metadata={"nested": suspicious_nested})

        serialized = dumpd(doc)
        # The nested dict with 'lc' key should be escaped
        assert serialized["kwargs"]["metadata"]["nested"] == {
            "__lc_escaped__": suspicious_nested
        }

        loaded = load(serialized, allowed_objects=[Document])
        assert loaded.metadata == {"nested": suspicious_nested}

Domain

Subdomains

Frequently Asked Questions

What does test_document_metadata_with_nested_lc_key_escaped() do?
test_document_metadata_with_nested_lc_key_escaped() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_serializable.py.
Where is test_document_metadata_with_nested_lc_key_escaped() defined?
test_document_metadata_with_nested_lc_key_escaped() is defined in libs/core/tests/unit_tests/load/test_serializable.py at line 425.
What does test_document_metadata_with_nested_lc_key_escaped() call?
test_document_metadata_with_nested_lc_key_escaped() calls 1 function(s): test_document_metadata_with_nested_lc_key_escaped.
What calls test_document_metadata_with_nested_lc_key_escaped()?
test_document_metadata_with_nested_lc_key_escaped() is called by 1 function(s): test_document_metadata_with_nested_lc_key_escaped.

Analyze Your Own Codebase

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

Try Supermodel Free