test_init_validator_with_loads() — langchain Function Reference
Architecture documentation for the test_init_validator_with_loads() function in test_serializable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6604f3f4_cdec_6e36_5251_a66e4a5cf624["test_init_validator_with_loads()"] ff9fa6f4_1eec_e12e_ec54_642a0a26cc2d["TestInitValidator"] 6604f3f4_cdec_6e36_5251_a66e4a5cf624 -->|defined in| ff9fa6f4_1eec_e12e_ec54_642a0a26cc2d style 6604f3f4_cdec_6e36_5251_a66e4a5cf624 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/load/test_serializable.py lines 666–679
def test_init_validator_with_loads(self) -> None:
"""Test that `init_validator` works with `loads()` function."""
doc = Document(page_content="test", metadata={"key": "value"})
json_str = dumps(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"):
loads(json_str, allowed_objects=[Document], init_validator=block_metadata)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_init_validator_with_loads() do?
test_init_validator_with_loads() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_serializable.py.
Where is test_init_validator_with_loads() defined?
test_init_validator_with_loads() is defined in libs/core/tests/unit_tests/load/test_serializable.py at line 666.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free