Home / Function/ test_init_connection_error() — langchain Function Reference

test_init_connection_error() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2e2752e3_9e86_4ab4_645e_25f80f4c8f49["test_init_connection_error()"]
  71dcb56e_a445_727d_c4bb_5dc733f24038["test_chat_models.py"]
  2e2752e3_9e86_4ab4_645e_25f80f4c8f49 -->|defined in| 71dcb56e_a445_727d_c4bb_5dc733f24038
  style 2e2752e3_9e86_4ab4_645e_25f80f4c8f49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py lines 42–48

def test_init_connection_error(mock_list: MagicMock) -> None:
    """Test that a `ValidationError` is raised on connect failure during init."""
    mock_list.side_effect = ConnectError("Test connection error")

    with pytest.raises(ValidationError) as excinfo:
        ChatOllama(model="any-model", validate_model_on_init=True)
    assert "Failed to connect to Ollama" in str(excinfo.value)

Domain

Subdomains

Frequently Asked Questions

What does test_init_connection_error() do?
test_init_connection_error() is a function in the langchain codebase, defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py.
Where is test_init_connection_error() defined?
test_init_connection_error() is defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models.py at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free