test_context_overflow_error_backwards_compatibility() — langchain Function Reference
Architecture documentation for the test_context_overflow_error_backwards_compatibility() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3ff606ab_4711_3a39_4b31_37cad5b5dc46["test_context_overflow_error_backwards_compatibility()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] 3ff606ab_4711_3a39_4b31_37cad5b5dc46 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style 3ff606ab_4711_3a39_4b31_37cad5b5dc46 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3381–3394
def test_context_overflow_error_backwards_compatibility() -> None:
"""Test that ContextOverflowError can be caught as BadRequestError."""
llm = ChatOpenAI()
with ( # noqa: PT012
patch.object(llm.client, "with_raw_response") as mock_client,
pytest.raises(openai.BadRequestError) as exc_info,
):
mock_client.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, openai.BadRequestError)
assert isinstance(exc_info.value, ContextOverflowError)
Domain
Subdomains
Source
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/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_context_overflow_error_backwards_compatibility() defined?
test_context_overflow_error_backwards_compatibility() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 3381.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free