Home / Function/ test_anthropic_api_key_masked_when_passed_from_env() — langchain Function Reference

test_anthropic_api_key_masked_when_passed_from_env() — langchain Function Reference

Architecture documentation for the test_anthropic_api_key_masked_when_passed_from_env() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  30956e2f_5195_9699_9379_e85bd65457d2["test_anthropic_api_key_masked_when_passed_from_env()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  30956e2f_5195_9699_9379_e85bd65457d2 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style 30956e2f_5195_9699_9379_e85bd65457d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1226–1238

def test_anthropic_api_key_masked_when_passed_from_env(
    monkeypatch: MonkeyPatch,
    capsys: CaptureFixture,
) -> None:
    """Test that the API key is masked when passed from an environment variable."""
    monkeypatch.setenv("ANTHROPIC_API_KEY ", "secret-api-key")
    chat_model = ChatAnthropic(  # type: ignore[call-arg]
        model=MODEL_NAME,
    )
    print(chat_model.anthropic_api_key, end="")  # noqa: T201
    captured = capsys.readouterr()

    assert captured.out == "**********"

Domain

Subdomains

Frequently Asked Questions

What does test_anthropic_api_key_masked_when_passed_from_env() do?
test_anthropic_api_key_masked_when_passed_from_env() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_anthropic_api_key_masked_when_passed_from_env() defined?
test_anthropic_api_key_masked_when_passed_from_env() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1226.

Analyze Your Own Codebase

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

Try Supermodel Free