Disable mypy arg-type and assignment checks in tests (#59428)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
17e9295dd5
commit
fc2c801ad9
@@ -1447,7 +1447,7 @@ class TestDetectMergeInlineSystem:
|
||||
model_config=None,
|
||||
)
|
||||
assert (
|
||||
AnthropicServingMessages._should_merge_inline_system(online_renderer) # type: ignore[arg-type]
|
||||
AnthropicServingMessages._should_merge_inline_system(online_renderer)
|
||||
is expected
|
||||
)
|
||||
assert mock_logger.warning_once.called is expected
|
||||
|
||||
@@ -29,7 +29,7 @@ from vllm.entrypoints.cohere.cohere_chat_message import (
|
||||
class TestCitationSource:
|
||||
def test_invalid_type_rejected(self):
|
||||
with pytest.raises(ValidationError):
|
||||
CitationSource(type="other") # type: ignore[arg-type]
|
||||
CitationSource(type="other")
|
||||
|
||||
def test_none_fields_excluded_from_dump(self):
|
||||
s = CitationSource(type="document", id="d1")
|
||||
@@ -65,7 +65,7 @@ class TestCitationSource:
|
||||
class TestCitation:
|
||||
def test_invalid_type_rejected(self):
|
||||
with pytest.raises(ValidationError):
|
||||
Citation(type="OTHER") # type: ignore[arg-type]
|
||||
Citation(type="OTHER")
|
||||
|
||||
def test_dump_excludes_none_fields(self):
|
||||
c = Citation(start=0, end=5, text="hello")
|
||||
|
||||
@@ -136,7 +136,7 @@ class TestCohereChatV2Response:
|
||||
with pytest.raises(ValidationError):
|
||||
CohereChatV2Response(
|
||||
id="r1",
|
||||
finish_reason="NOT_A_REASON", # type: ignore[arg-type]
|
||||
finish_reason="NOT_A_REASON",
|
||||
message=msg,
|
||||
)
|
||||
|
||||
@@ -246,5 +246,5 @@ class TestStreamingEventTypeField:
|
||||
MessageStartEvent(
|
||||
id="a",
|
||||
delta={"message": {"role": "assistant"}},
|
||||
type="other", # type: ignore[arg-type]
|
||||
type="other",
|
||||
)
|
||||
|
||||
@@ -308,7 +308,7 @@ def test_external_process_monitoring(api_server_args):
|
||||
try:
|
||||
wait_for_completion_or_failure(
|
||||
api_server_manager=manager,
|
||||
coordinator=mock_coordinator, # type: ignore[arg-type]
|
||||
coordinator=mock_coordinator,
|
||||
)
|
||||
except Exception as e:
|
||||
result["exception"] = e
|
||||
@@ -377,7 +377,7 @@ def test_gather_actual_addresses_end_to_end():
|
||||
manager = APIServerProcessManager(
|
||||
listen_address=f"tcp://{host}:0",
|
||||
sock=sock,
|
||||
args="test_args", # type: ignore[arg-type]
|
||||
args="test_args",
|
||||
num_servers=num_servers,
|
||||
input_addresses=placeholder_inputs,
|
||||
output_addresses=placeholder_outputs,
|
||||
@@ -424,7 +424,7 @@ def test_gather_actual_addresses_child_crash_before_report():
|
||||
manager = APIServerProcessManager(
|
||||
listen_address=f"tcp://{host}:0",
|
||||
sock=sock,
|
||||
args="test_args", # type: ignore[arg-type]
|
||||
args="test_args",
|
||||
num_servers=num_servers,
|
||||
input_addresses=placeholder_inputs,
|
||||
output_addresses=placeholder_outputs,
|
||||
|
||||
@@ -14,7 +14,7 @@ from vllm.outputs import RequestOutput
|
||||
|
||||
def _make_mock_llm() -> LLM:
|
||||
llm = object.__new__(LLM)
|
||||
llm.model_config = SimpleNamespace( # type: ignore[assignment]
|
||||
llm.model_config = SimpleNamespace(
|
||||
runner_type="generate", enable_prompt_embeds=False
|
||||
)
|
||||
return llm
|
||||
|
||||
@@ -225,7 +225,7 @@ def online_renderer(model_config: MockModelConfig, request) -> OnlineRenderer:
|
||||
renderer.tokenizer = MagicMock()
|
||||
|
||||
return OnlineRenderer(
|
||||
model_config=model_config, # type: ignore[arg-type]
|
||||
model_config=model_config,
|
||||
renderer=renderer,
|
||||
request_logger=None,
|
||||
chat_template=None,
|
||||
|
||||
@@ -411,7 +411,7 @@ class TestChunkedEmbeddingProcessing:
|
||||
@classmethod
|
||||
def _make_handler(cls):
|
||||
handler = object.__new__(EmbedIOProcessor)
|
||||
handler.model_config = cls._FakeModelConfig() # type: ignore[assignment]
|
||||
handler.model_config = cls._FakeModelConfig()
|
||||
handler.enable_chunked_processing = True
|
||||
return handler
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def llm_reranker_processor() -> CrossEncoderIOProcessor:
|
||||
)
|
||||
|
||||
processor = CrossEncoderIOProcessor.__new__(CrossEncoderIOProcessor)
|
||||
processor.model_config = SimpleNamespace(enable_prompt_embeds=False) # type: ignore[assignment]
|
||||
processor.model_config = SimpleNamespace(enable_prompt_embeds=False)
|
||||
processor.tokenizer = TokenizersBackend(
|
||||
tokenizer_object=backend,
|
||||
unk_token="[UNK]",
|
||||
@@ -96,7 +96,7 @@ def test_token_type_ids_stay_aligned_with_a_truncated_padded_prompt():
|
||||
)
|
||||
|
||||
processed_prompt = tok_params.apply_post_tokenization(
|
||||
tokenizer, # type: ignore[arg-type]
|
||||
tokenizer,
|
||||
prompt,
|
||||
)
|
||||
assert "prompt_token_ids" in processed_prompt
|
||||
|
||||
@@ -77,10 +77,8 @@ def offline_processor_and_context():
|
||||
backend.pre_tokenizer = pre_tokenizers.WhitespaceSplit()
|
||||
proc = JinaRankingIOProcessor.__new__(JinaRankingIOProcessor)
|
||||
proc.tokenizer = TokenizersBackend(tokenizer_object=backend)
|
||||
proc.model_config = SimpleNamespace( # type: ignore[assignment]
|
||||
max_model_len=1024, is_encoder_decoder=False
|
||||
)
|
||||
proc.renderer = SimpleNamespace( # type: ignore[assignment]
|
||||
proc.model_config = SimpleNamespace(max_model_len=1024, is_encoder_decoder=False)
|
||||
proc.renderer = SimpleNamespace(
|
||||
default_cmpl_tok_params=TokenizeParams(max_total_tokens=1024)
|
||||
)
|
||||
ctx = OfflineScoringInputsContext(
|
||||
|
||||
@@ -53,8 +53,8 @@ def test_rejects_mismatched_lora_requests(processor: PoolingIOProcessor):
|
||||
|
||||
|
||||
def test_rejects_conflicting_pooling_task(processor: PoolingIOProcessor):
|
||||
processor.model_config = SimpleNamespace(is_encoder_decoder=False) # type: ignore[assignment]
|
||||
processor.renderer = SimpleNamespace( # type: ignore[assignment] # Tokenization defaults only.
|
||||
processor.model_config = SimpleNamespace(is_encoder_decoder=False)
|
||||
processor.renderer = SimpleNamespace(
|
||||
default_cmpl_tok_params=TokenizeParams(max_total_tokens=None)
|
||||
)
|
||||
ctx = OfflineEncodeInputsContext(
|
||||
|
||||
@@ -87,7 +87,7 @@ def task_routes(request, monkeypatch) -> tuple[str, list[tuple[str, list[str]]]]
|
||||
args,
|
||||
app,
|
||||
supported_tasks=(task,),
|
||||
model_config=MockModelConfig(), # type: ignore[arg-type]
|
||||
model_config=MockModelConfig(),
|
||||
)
|
||||
|
||||
routes = get_all_http_routes(app)
|
||||
|
||||
@@ -107,7 +107,7 @@ async def test_tokenize_chat(
|
||||
conversation=conversation,
|
||||
tokenize=False,
|
||||
)
|
||||
tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type]
|
||||
tokens = tokenizer.encode(prompt, add_special_tokens=add_special)
|
||||
|
||||
response = requests.post(
|
||||
server.url_for("tokenize"),
|
||||
@@ -176,7 +176,7 @@ async def test_tokenize_chat_with_tools(
|
||||
tools=tools,
|
||||
tokenize=False,
|
||||
)
|
||||
tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type]
|
||||
tokens = tokenizer.encode(prompt, add_special_tokens=add_special)
|
||||
|
||||
response = requests.post(
|
||||
server.url_for("tokenize"),
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_sanitize_handles_falsy_inputs() -> None:
|
||||
assert _sanitize_transcription_user_text("") == ""
|
||||
# The dataclass default for ``response_prefix`` is the empty string;
|
||||
# the sanitizer must accept that without exception or extra work.
|
||||
assert _sanitize_transcription_user_text(None) == "" # type: ignore[arg-type]
|
||||
assert _sanitize_transcription_user_text(None) == ""
|
||||
|
||||
|
||||
def test_sanitize_is_idempotent() -> None:
|
||||
|
||||
@@ -216,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) # type: ignore[arg-type]
|
||||
return encode_audio_url(*audio.audio_and_sample_rate)
|
||||
|
||||
|
||||
def _assert_mm_data_is_image_input(
|
||||
@@ -3194,5 +3194,5 @@ def test_validate_chat_template_rejects_invalid_type():
|
||||
with pytest.raises(
|
||||
VLLMValidationError, match="not a valid chat template type"
|
||||
) as exc_info:
|
||||
validate_chat_template(123) # type: ignore[arg-type]
|
||||
validate_chat_template(123)
|
||||
assert exc_info.value.parameter == "chat_template"
|
||||
|
||||
Reference in New Issue
Block a user