Home / Function/ test_simple_serialization_secret() — langchain Function Reference

test_simple_serialization_secret() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9b5c9c0b_cec8_52a8_b380_8920215d06ee["test_simple_serialization_secret()"]
  d90477e3_b806_4058_daf0_8495f08436d6["test_serializable.py"]
  9b5c9c0b_cec8_52a8_b380_8920215d06ee -->|defined in| d90477e3_b806_4058_daf0_8495f08436d6
  d808064d_42c1_7911_0cbd_2d2d6cb52046["lc_secrets()"]
  9b5c9c0b_cec8_52a8_b380_8920215d06ee -->|calls| d808064d_42c1_7911_0cbd_2d2d6cb52046
  32e847bb_79c8_2c81_4d16_4051f39f43ae["is_lc_serializable()"]
  9b5c9c0b_cec8_52a8_b380_8920215d06ee -->|calls| 32e847bb_79c8_2c81_4d16_4051f39f43ae
  style 9b5c9c0b_cec8_52a8_b380_8920215d06ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/load/test_serializable.py lines 70–100

def test_simple_serialization_secret() -> None:
    """Test handling of secrets."""

    class Foo(Serializable):
        bar: int
        baz: str
        secret: SecretStr
        secret_2: str

        @classmethod
        def is_lc_serializable(cls) -> bool:
            return True

        @property
        def lc_secrets(self) -> dict[str, str]:
            return {"secret": "MASKED_SECRET", "secret_2": "MASKED_SECRET_2"}

    foo = Foo(
        bar=1, baz="baz", secret=SecretStr("SUPER_SECRET"), secret_2="SUPER_SECRET"
    )
    assert dumpd(foo) == {
        "id": ["tests", "unit_tests", "load", "test_serializable", "Foo"],
        "kwargs": {
            "bar": 1,
            "baz": "baz",
            "secret": {"id": ["MASKED_SECRET"], "lc": 1, "type": "secret"},
            "secret_2": {"id": ["MASKED_SECRET_2"], "lc": 1, "type": "secret"},
        },
        "lc": 1,
        "type": "constructor",
    }

Domain

Subdomains

Frequently Asked Questions

What does test_simple_serialization_secret() do?
test_simple_serialization_secret() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_serializable.py.
Where is test_simple_serialization_secret() defined?
test_simple_serialization_secret() is defined in libs/core/tests/unit_tests/load/test_serializable.py at line 70.
What does test_simple_serialization_secret() call?
test_simple_serialization_secret() calls 2 function(s): is_lc_serializable, lc_secrets.

Analyze Your Own Codebase

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

Try Supermodel Free