Home / Function/ test_allowed_objects() — langchain Function Reference

test_allowed_objects() — langchain Function Reference

Architecture documentation for the test_allowed_objects() function in test_secret_injection.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  baf82d7e_8bb9_0cf0_9a03_1569b8ddd377["test_allowed_objects()"]
  901a6c0c_2813_c391_3a48_4db4b001544d["test_secret_injection.py"]
  baf82d7e_8bb9_0cf0_9a03_1569b8ddd377 -->|defined in| 901a6c0c_2813_c391_3a48_4db4b001544d
  style baf82d7e_8bb9_0cf0_9a03_1569b8ddd377 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/load/test_secret_injection.py lines 420–431

def test_allowed_objects() -> None:
    # Core object
    msg = AIMessage(content="foo")
    serialized = dumpd(msg)
    assert load(serialized) == msg
    assert load(serialized, allowed_objects=[AIMessage]) == msg
    assert load(serialized, allowed_objects="core") == msg

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

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free