Home / Function/ test_context_overflow_error_stream_sync() — langchain Function Reference

test_context_overflow_error_stream_sync() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 2348–2359

def test_context_overflow_error_stream_sync() -> None:
    """Test context overflow error on stream (sync)."""
    llm = ChatAnthropic(model=MODEL_NAME)

    with (  # noqa: PT012
        patch.object(llm._client.messages, "create") as mock_create,
        pytest.raises(ContextOverflowError) as exc_info,
    ):
        mock_create.side_effect = _CONTEXT_OVERFLOW_BAD_REQUEST_ERROR
        list(llm.stream([HumanMessage(content="test")]))

    assert "prompt is too long" in str(exc_info.value)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free