test(router): assert the context-window error reports the deployment's own count

This commit is contained in:
mateo-berri 2026-10-29 09:02:00 -07:00
parent 1805dc0ea5
commit 198b31b9d5
2 changed files with 4 additions and 2 deletions

View file

@ -185,7 +185,7 @@ ignored_function_names = [
"_pre_call_check_token_count", # Run by _pre_call_check_token_counts, tested through the per-deployment pre-call check tests in test_router.py
"_pre_call_check_token_counts", # Run by _pre_call_checks and _acount_pre_call_check_tokens, tested through the pre-call check tests in test_router.py
"_resolve_pre_call_check_token_counts", # Run by _pre_call_checks, tested through the precounted and inline pre-call check tests in test_router.py
"_context_window_exceeded_line", # Builds the ContextWindowExceededError text, tested through the Got= assertions in test_router.py
"_context_window_exceeded_line", # Builds the ContextWindowExceededError text, tested through the stand-in margin refusal test in test_router.py
]

View file

@ -30351,7 +30351,9 @@ def test_pre_call_checks_refuses_a_stand_in_count_past_the_margin():
tokens: Final = _stand_in_tokens(_RUSSIAN_PROMPT)
largest_window_past_margin: Final = (tokens - 1) // STAND_IN_OVERCOUNT_MARGIN
with pytest.raises(litellm.ContextWindowExceededError):
with pytest.raises(
litellm.ContextWindowExceededError, match=f"Max Input Tokens={largest_window_past_margin}, Got={tokens}"
):
_kept_ids(_single_deployment("openai/my-fake-model", largest_window_past_margin), _RUSSIAN_PROMPT)