Home / Function/ test_init_validator_blocks_deserialization() — langchain Function Reference

test_init_validator_blocks_deserialization() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  aea75c11_2f7c_f411_2a77_87afb9a5e3e6["test_init_validator_blocks_deserialization()"]
  ff9fa6f4_1eec_e12e_ec54_642a0a26cc2d["TestInitValidator"]
  aea75c11_2f7c_f411_2a77_87afb9a5e3e6 -->|defined in| ff9fa6f4_1eec_e12e_ec54_642a0a26cc2d
  style aea75c11_2f7c_f411_2a77_87afb9a5e3e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/load/test_serializable.py lines 609–622

    def test_init_validator_blocks_deserialization(self) -> None:
        """Test that `init_validator` can block deserialization by raising."""
        doc = Document(page_content="test", metadata={"source": "test.txt"})
        serialized = dumpd(doc)

        def block_metadata(
            _class_path: tuple[str, ...], kwargs: dict[str, Any]
        ) -> None:
            if "metadata" in kwargs:
                msg = "Metadata not allowed"
                raise ValueError(msg)

        with pytest.raises(ValueError, match="Metadata not allowed"):
            load(serialized, allowed_objects=[Document], init_validator=block_metadata)

Domain

Subdomains

Frequently Asked Questions

What does test_init_validator_blocks_deserialization() do?
test_init_validator_blocks_deserialization() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_serializable.py.
Where is test_init_validator_blocks_deserialization() defined?
test_init_validator_blocks_deserialization() is defined in libs/core/tests/unit_tests/load/test_serializable.py at line 609.

Analyze Your Own Codebase

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

Try Supermodel Free