Home / Function/ test_load_response_with_whitespace_content_is_skipped() — langchain Function Reference

test_load_response_with_whitespace_content_is_skipped() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5e734529_f7c2_0b8a_de17_f925c4cc0a64["test_load_response_with_whitespace_content_is_skipped()"]
  9c4a2438_9884_cbb0_3cf5_de8827531653["test_chat_models.py"]
  5e734529_f7c2_0b8a_de17_f925c4cc0a64 -->|defined in| 9c4a2438_9884_cbb0_3cf5_de8827531653
  style 5e734529_f7c2_0b8a_de17_f925c4cc0a64 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_chat_models.py lines 218–244

def test_load_response_with_whitespace_content_is_skipped(
    caplog: pytest.LogCaptureFixture,
) -> None:
    """Test load responses w/ only whitespace content log a warning and are skipped."""
    load_whitespace_response = [
        {
            "model": "test-model",
            "created_at": "2025-01-01T00:00:00.000000000Z",
            "done": True,
            "done_reason": "load",
            "message": {"role": "assistant", "content": "   \n  \t  "},
        }
    ]

    with patch("langchain_ollama.chat_models.Client") as mock_client_class:
        mock_client = MagicMock()
        mock_client_class.return_value = mock_client
        mock_client.chat.return_value = load_whitespace_response

        llm = ChatOllama(model="test-model")

        with (
            caplog.at_level(logging.WARNING),
            pytest.raises(ValueError, match="No data received from Ollama stream"),
        ):
            llm.invoke([HumanMessage("Hello")])
        assert "Ollama returned empty response with done_reason='load'" in caplog.text

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free