Home / Function/ test_context_overflow_error_backwards_compatibility() — langchain Function Reference

test_context_overflow_error_backwards_compatibility() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 2377–2390

def test_context_overflow_error_backwards_compatibility() -> None:
    """Test that ContextOverflowError can be caught as BadRequestError."""
    llm = ChatAnthropic(model=MODEL_NAME)

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

    # Verify it's both types (multiple inheritance)
    assert isinstance(exc_info.value, anthropic.BadRequestError)
    assert isinstance(exc_info.value, ContextOverflowError)

Domain

Subdomains

Frequently Asked Questions

What does test_context_overflow_error_backwards_compatibility() do?
test_context_overflow_error_backwards_compatibility() 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_backwards_compatibility() defined?
test_context_overflow_error_backwards_compatibility() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 2377.

Analyze Your Own Codebase

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

Try Supermodel Free