Merge pull request #34635 from BerriAI/litellm_/remove-no-guard-mirror-tests

test: remove four mirror test files that exercise none of their module
This commit is contained in:
yuneng-jiang 2026-08-12 10:51:57 -07:00 • committed by GitHub
commit 5cbe8353be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 0 additions and 1581 deletions

View file

@ -1,37 +0,0 @@
"""
Tests for the guardrail_translation_mappings registry.
Validates:
- allm_passthrough_route is registered in the mappings (regression: this was the bug)
"""
from litellm.llms.pass_through.guardrail_translation import (
guardrail_translation_mappings,
)
from litellm.llms.pass_through.guardrail_translation.handler import (
LlmPassthroughRouteHandler,
)
from litellm.types.utils import CallTypes
class TestRegistry:
def test_allm_passthrough_route_registered(self):
"""Regression: missing this mapping was the root cause of the bug."""
assert CallTypes.allm_passthrough_route in guardrail_translation_mappings
def test_allm_passthrough_route_maps_to_llm_passthrough_route_handler(self):
assert (
guardrail_translation_mappings[CallTypes.allm_passthrough_route]
is LlmPassthroughRouteHandler
)
def test_pass_through_still_registered(self):
from litellm.llms.pass_through.guardrail_translation.handler import (
PassThroughEndpointHandler,
)
assert (
guardrail_translation_mappings[CallTypes.pass_through]
is PassThroughEndpointHandler
)

View file

@ -1,296 +0,0 @@
"""
Test reasoning content preservation in Responses API transformation
"""
from unittest.mock import AsyncMock
from litellm.responses.litellm_completion_transformation.streaming_iterator import (
LiteLLMCompletionStreamingIterator,
)
from litellm.responses.litellm_completion_transformation.transformation import (
LiteLLMCompletionResponsesConfig,
)
from litellm.types.utils import (
Choices,
Delta,
Message,
ModelResponse,
ModelResponseStream,
StreamingChoices,
)
class TestReasoningContentStreaming:
"""Test reasoning content preservation during streaming"""
def test_reasoning_content_in_delta(self):
"""Test that reasoning content is preserved in streaming deltas"""
# Setup
chunk = ModelResponseStream(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion.chunk",
choices=[
StreamingChoices(
finish_reason=None,
index=0,
delta=Delta(
content="",
role="assistant",
reasoning_content="Let me think about this problem...",
),
)
],
)
mock_stream = AsyncMock()
iterator = LiteLLMCompletionStreamingIterator(
model="test-model",
litellm_custom_stream_wrapper=mock_stream,
request_input="Test input",
responses_api_request={},
)
# Execute
transformed_chunk = (
iterator._transform_chat_completion_chunk_to_response_api_chunk(chunk)
)
# Assert
assert transformed_chunk.delta == "Let me think about this problem..."
assert transformed_chunk.type == "response.reasoning_summary_text.delta"
def test_mixed_content_and_reasoning(self):
"""Test handling of both content and reasoning content"""
# Setup
chunk = ModelResponseStream(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion.chunk",
choices=[
StreamingChoices(
finish_reason=None,
index=0,
delta=Delta(
content="Here is the answer",
role="assistant",
reasoning_content="First, let me analyze...",
),
)
],
)
mock_stream = AsyncMock()
iterator = LiteLLMCompletionStreamingIterator(
model="test-model",
litellm_custom_stream_wrapper=mock_stream,
request_input="Test input",
responses_api_request={},
)
# Execute
transformed_chunk = (
iterator._transform_chat_completion_chunk_to_response_api_chunk(chunk)
)
# Assert
assert transformed_chunk.delta == "First, let me analyze..."
assert transformed_chunk.type == "response.reasoning_summary_text.delta"
def test_no_reasoning_content(self):
"""Test handling when no reasoning content is present"""
# Setup
chunk = ModelResponseStream(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion.chunk",
choices=[
StreamingChoices(
finish_reason=None,
index=0,
delta=Delta(
content="Regular content only",
role="assistant",
),
)
],
)
mock_stream = AsyncMock()
iterator = LiteLLMCompletionStreamingIterator(
model="test-model",
litellm_custom_stream_wrapper=mock_stream,
request_input="Test input",
responses_api_request={},
)
# Execute
transformed_chunk = (
iterator._transform_chat_completion_chunk_to_response_api_chunk(chunk)
)
# Assert
assert transformed_chunk.delta == "Regular content only"
assert transformed_chunk.type == "response.output_text.delta"
class TestReasoningContentFinalResponse:
"""Test reasoning content preservation in final response transformation"""
def test_reasoning_content_in_final_response(self):
"""Test that reasoning content is included in final response"""
# Setup
response = ModelResponse(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion",
choices=[
Choices(
finish_reason="stop",
index=0,
message=Message(
content="Here is my answer",
role="assistant",
reasoning_content="Let me think step by step about this problem...",
),
)
],
)
# Execute
responses_api_response = LiteLLMCompletionResponsesConfig.transform_chat_completion_response_to_responses_api_response(
request_input="Test input",
responses_api_request={},
chat_completion_response=response,
)
# Assert
assert hasattr(responses_api_response, "output")
assert len(responses_api_response.output) > 0
reasoning_items = [
item for item in responses_api_response.output if item.type == "reasoning"
]
assert len(reasoning_items) > 0, "No reasoning item found in output"
reasoning_item = reasoning_items[0]
assert (
reasoning_item.content[0].text
== "Let me think step by step about this problem..."
)
def test_no_reasoning_content_in_response(self):
"""Test handling when no reasoning content in response"""
# Setup
response = ModelResponse(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion",
choices=[
Choices(
finish_reason="stop",
index=0,
message=Message(
content="Simple answer",
role="assistant",
),
)
],
)
# Execute
responses_api_response = LiteLLMCompletionResponsesConfig.transform_chat_completion_response_to_responses_api_response(
request_input="Test input",
responses_api_request={},
chat_completion_response=response,
)
# Assert
reasoning_items = [
item for item in responses_api_response.output if item.type == "reasoning"
]
assert (
len(reasoning_items) == 0
), "Should have no reasoning items when no reasoning content present"
def test_multiple_choices_with_reasoning(self):
"""Test handling multiple choices, first with reasoning content"""
# Setup
response = ModelResponse(
id="test-id",
created=1234567890,
model="test-model",
object="chat.completion",
choices=[
Choices(
finish_reason="stop",
index=0,
message=Message(
content="First answer",
role="assistant",
reasoning_content="Reasoning for first answer",
),
),
Choices(
finish_reason="stop",
index=1,
message=Message(
content="Second answer",
role="assistant",
reasoning_content="Reasoning for second answer",
),
),
],
)
# Execute
responses_api_response = LiteLLMCompletionResponsesConfig.transform_chat_completion_response_to_responses_api_response(
request_input="Test input",
responses_api_request={},
chat_completion_response=response,
)
# Assert
reasoning_items = [
item for item in responses_api_response.output if item.type == "reasoning"
]
assert len(reasoning_items) == 1, "Should have exactly one reasoning item"
assert reasoning_items[0].content[0].text == "Reasoning for first answer"
def test_streaming_chunk_id_raw():
"""Test that streaming chunk IDs are raw (not encoded) to match OpenAI format"""
chunk = ModelResponseStream(
id="chunk-123",
created=1234567890,
model="test-model",
object="chat.completion.chunk",
choices=[
StreamingChoices(
finish_reason=None,
index=0,
delta=Delta(content="Hello", role="assistant"),
)
],
)
iterator = LiteLLMCompletionStreamingIterator(
model="test-model",
litellm_custom_stream_wrapper=AsyncMock(),
request_input="Test input",
responses_api_request={},
custom_llm_provider="openai",
litellm_metadata={"model_info": {"id": "gpt-4"}},
)
result = iterator._transform_chat_completion_chunk_to_response_api_chunk(chunk)
# Streaming chunk IDs should be raw (like OpenAI's msg_xxx format)
assert result.item_id == "chunk-123" # Should be raw, not encoded
assert not result.item_id.startswith("resp_") # Should NOT have resp_ prefix

View file

@ -1,53 +0,0 @@
"""
Test suite for Azure video router functionality.
Tests that the router method gets called correctly for Azure video generation.
"""
import pytest
from unittest.mock import Mock, patch, MagicMock
import litellm
class TestAzureVideoRouter:
"""Test suite for Azure video router functionality"""
def setup_method(self):
"""Setup test fixtures"""
self.model = "azure/sora-2"
self.prompt = "A beautiful sunset over mountains"
self.seconds = "5"
self.size = "1280x720"
@patch("litellm.videos.main.base_llm_http_handler")
def test_azure_video_generation_router_call_mock(self, mock_handler):
"""Test that Azure video generation calls the router method with mock response"""
# Setup mock response
mock_response = {
"id": "video_123",
"model": "sora-2",
"object": "video",
"status": "processing",
"created_at": 1234567890,
"progress": 0,
}
# Configure the mock handler
mock_handler.video_generation_handler.return_value = mock_response
# Call the video generation function with mock response
result = litellm.video_generation(
prompt=self.prompt,
model=self.model,
seconds=self.seconds,
size=self.size,
custom_llm_provider="azure",
mock_response=mock_response,
)
# Verify the result is a VideoObject with the expected data
assert result.id == mock_response["id"]
assert result.model == mock_response["model"]
assert result.object == mock_response["object"]
assert result.status == mock_response["status"]
assert result.created_at == mock_response["created_at"]
assert result.progress == mock_response["progress"]