mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
test(anthropic): cover attempt-scoped interruption logging
This commit is contained in:
parent
6bd10f8adf
commit
647a962f41
1 changed files with 4 additions and 0 deletions
|
|
@ -182,6 +182,9 @@ async def test_interrupted_anthropic_stream_recovers_output_tokens_off_the_event
|
|||
logging_obj.get_router_model_id.return_value = None
|
||||
logging_obj.dispatch_success_handlers = AsyncMock()
|
||||
logging_obj.dispatch_failure_handlers = AsyncMock()
|
||||
logging_obj.dispatch_attempt_failure_handlers = AsyncMock(
|
||||
side_effect=logging_obj.dispatch_failure_handlers
|
||||
)
|
||||
|
||||
_, took, lags = await timed_with_loop_lags(
|
||||
lambda: PassThroughStreamingHandler._route_streaming_logging_to_handler(
|
||||
|
|
@ -198,6 +201,7 @@ async def test_interrupted_anthropic_stream_recovers_output_tokens_off_the_event
|
|||
)
|
||||
|
||||
logging_obj.dispatch_success_handlers.assert_not_awaited()
|
||||
logging_obj.dispatch_attempt_failure_handlers.assert_awaited_once()
|
||||
logging_obj.dispatch_failure_handlers.assert_awaited_once()
|
||||
logged_usage = logging_obj.record_partial_usage_for_failure.call_args.kwargs["usage"]
|
||||
assert logged_usage.completion_tokens > 100_000
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue