[MyPy][2/N] Fix mypy errors in small tests/ dirs (#51043)

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Hickey
2026-09-29 21:27:45 +01:00
committed by GitHub
co-authored by Harry Mellor Claude Opus 5.5
parent a96ee5935d
commit 5dd693122c
71 changed files with 491 additions and 301 deletions
+18 -16
View File
@@ -17,6 +17,7 @@ from vllm.config import ModelConfig
from vllm.entrypoints.chat_utils import (
MEDIA_CONNECTOR_REGISTRY,
AsyncMultiModalItemTracker,
ChatCompletionMessageParam,
ConversationMessage,
_load_embeds_dict,
_parse_metadata_array,
@@ -215,7 +216,7 @@ def video_url():
@pytest.fixture(scope="module")
def audio_url():
audio = AudioAsset("mary_had_lamb")
return encode_audio_url(*audio.audio_and_sample_rate)
return encode_audio_url(*audio.audio_and_sample_rate) # type: ignore[arg-type]
def _assert_mm_data_is_image_input(
@@ -769,7 +770,9 @@ async def test_text_only_chat_does_not_initialize_media_connector(
):
load_connector = MagicMock()
monkeypatch.setattr(MEDIA_CONNECTOR_REGISTRY, "load", load_connector)
messages = [{"role": "user", "content": "Who are you?"}]
messages: list[ChatCompletionMessageParam] = [
{"role": "user", "content": "Who are you?"}
]
parse_chat_messages(
messages,
@@ -2457,7 +2460,7 @@ def test_parse_chat_messages_image_vision_chunk(
kimi_k2_5_model_config,
image_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2493,7 +2496,7 @@ def test_parse_chat_messages_video_vision_chunk(
kimi_k2_5_model_config,
video_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2530,7 +2533,7 @@ def test_parse_chat_messages_image_vision_chunk_with_uuid(
image_url,
):
image_uuid = "image_123"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2568,7 +2571,7 @@ def test_parse_chat_messages_video_vision_chunk_with_uuid(
video_url,
):
video_uuid = "video_456"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2606,7 +2609,7 @@ def test_parse_chat_messages_mixed_vision_chunk(
image_url,
video_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2655,7 +2658,7 @@ def test_parse_chat_messages_mixed_vision_chunk_with_uuid(
):
image_uuid = "image_123"
video_uuid = "video_456"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2707,7 +2710,7 @@ async def test_parse_chat_messages_mixed_vision_chunk_async(
image_url,
video_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2757,7 +2760,7 @@ async def test_parse_chat_messages_mixed_vision_chunk_with_uuid_async(
):
image_uuid = "image_123"
video_uuid = "video_456"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2808,7 +2811,7 @@ async def test_parse_chat_messages_image_vision_chunk_async(
kimi_k2_5_model_config,
image_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2845,7 +2848,7 @@ async def test_parse_chat_messages_video_vision_chunk_async(
kimi_k2_5_model_config,
video_url,
):
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2883,7 +2886,7 @@ async def test_parse_chat_messages_image_vision_chunk_with_uuid_async(
image_url,
):
image_uuid = "image_123"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2922,7 +2925,7 @@ async def test_parse_chat_messages_video_vision_chunk_with_uuid_async(
video_url,
):
video_uuid = "video_456"
messages = [
messages: list[ChatCompletionMessageParam] = [
{
"role": "user",
"content": [
@@ -2997,8 +3000,7 @@ async def test_resolve_items_runs_modalities_concurrently_and_preserves_order():
finally:
active_fetches -= 1
tracker = AsyncMultiModalItemTracker(MagicMock())
tracker._model_config.is_multimodal_model = True
tracker = AsyncMultiModalItemTracker(MagicMock(is_multimodal_model=True))
tracker.__dict__["mm_processor"] = MagicMock()
tracker._items_by_modality["video"] = [
lambda: _fetch("video-0", 0.02),