Home / Function/ test_secret_from_env_with_env_variable() — langchain Function Reference

test_secret_from_env_with_env_variable() — langchain Function Reference

Architecture documentation for the test_secret_from_env_with_env_variable() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ee1e960c_3877_e3da_0a18_8137987c9939["test_secret_from_env_with_env_variable()"]
  76328b48_c466_d255_3e8f_a315858c4c02["test_utils.py"]
  ee1e960c_3877_e3da_0a18_8137987c9939 -->|defined in| 76328b48_c466_d255_3e8f_a315858c4c02
  style ee1e960c_3877_e3da_0a18_8137987c9939 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/utils/test_utils.py lines 279–287

def test_secret_from_env_with_env_variable(monkeypatch: pytest.MonkeyPatch) -> None:
    # Set the environment variable
    monkeypatch.setenv("TEST_KEY", "secret_value")

    # Get the function
    get_secret: Callable[[], SecretStr | None] = secret_from_env("TEST_KEY")

    # Assert that it returns the correct value
    assert get_secret() == SecretStr("secret_value")

Domain

Subdomains

Frequently Asked Questions

What does test_secret_from_env_with_env_variable() do?
test_secret_from_env_with_env_variable() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_utils.py.
Where is test_secret_from_env_with_env_variable() defined?
test_secret_from_env_with_env_variable() is defined in libs/core/tests/unit_tests/utils/test_utils.py at line 279.

Analyze Your Own Codebase

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

Try Supermodel Free