Home / Function/ test_aliases_hidden() — langchain Function Reference

test_aliases_hidden() — langchain Function Reference

Architecture documentation for the test_aliases_hidden() function in test_dump.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fd709589_6af1_3bcd_2813_1954930fe3c3["test_aliases_hidden()"]
  fa1913ed_53d8_ed72_5806_c4cd35bee49c["test_dump.py"]
  fd709589_6af1_3bcd_2813_1954930fe3c3 -->|defined in| fa1913ed_53d8_ed72_5806_c4cd35bee49c
  style fd709589_6af1_3bcd_2813_1954930fe3c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/load/test_dump.py lines 121–168

def test_aliases_hidden() -> None:
    test_class = TestClass(
        my_favorite_secret="hello",  # noqa: S106
        my_other_secret="world",  # noqa: S106
    )
    dumped = json.loads(dumps(test_class, pretty=True))
    expected_dump = {
        "lc": 1,
        "type": "constructor",
        "id": ["my", "special", "namespace", "TestClass"],
        "kwargs": {
            "my_favorite_secret": {
                "lc": 1,
                "type": "secret",
                "id": ["MY_FAVORITE_SECRET"],
            },
            "my_other_secret": {"lc": 1, "type": "secret", "id": ["MY_OTHER_SECRET"]},
        },
    }
    assert dumped == expected_dump
    # Check while patching the os environment
    with patch.dict(
        os.environ,
        {"MY_FAVORITE_SECRET": "hello", "MY_OTHER_SECRET": "world"},
    ):
        test_class = TestClass()  # type: ignore[call-arg]
        dumped = json.loads(dumps(test_class, pretty=True))

    # Check by alias
    test_class = TestClass(  # type: ignore[call-arg]
        my_favorite_secret_alias="hello",  # noqa: S106
        my_other_secret="parrot party",  # noqa: S106
    )
    dumped = json.loads(dumps(test_class, pretty=True))
    expected_dump = {
        "lc": 1,
        "type": "constructor",
        "id": ["my", "special", "namespace", "TestClass"],
        "kwargs": {
            "my_favorite_secret": {
                "lc": 1,
                "type": "secret",
                "id": ["MY_FAVORITE_SECRET"],
            },
            "my_other_secret": {"lc": 1, "type": "secret", "id": ["MY_OTHER_SECRET"]},
        },
    }
    assert dumped == expected_dump

Domain

Subdomains

Frequently Asked Questions

What does test_aliases_hidden() do?
test_aliases_hidden() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/load/test_dump.py.
Where is test_aliases_hidden() defined?
test_aliases_hidden() is defined in libs/langchain/tests/unit_tests/load/test_dump.py at line 121.

Analyze Your Own Codebase

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

Try Supermodel Free