[CI] Ignore ruff D209, rejoin the docstrings it split, and silence incompatible-rule warnings (#57212)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1085b64425
commit
651a88c09a
@@ -12,8 +12,7 @@ from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
|
||||
|
||||
def test_function_call_dict_converted_to_object():
|
||||
"""Test that function_call dictionaries are correctly parsed into
|
||||
ResponseFunctionToolCall objects.
|
||||
"""
|
||||
ResponseFunctionToolCall objects."""
|
||||
# Create a request with function_call as dict
|
||||
request_data = {
|
||||
"model": "gpt-oss",
|
||||
@@ -330,8 +329,7 @@ def test_validator_handles_empty_iterator():
|
||||
|
||||
def test_assistant_string_content_stays_easyinput():
|
||||
"""EasyInput assistant message with plain string content is not
|
||||
coerced into a ResponseOutputMessage.
|
||||
"""
|
||||
coerced into a ResponseOutputMessage."""
|
||||
request_data = {
|
||||
"model": "test-model",
|
||||
"input": [
|
||||
@@ -353,8 +351,7 @@ def test_assistant_string_content_stays_easyinput():
|
||||
|
||||
def test_assistant_output_style_content_coerced():
|
||||
"""Assistant message whose content is output-message-shaped (list of
|
||||
output_text items) should be coerced to ResponseOutputMessage.
|
||||
"""
|
||||
output_text items) should be coerced to ResponseOutputMessage."""
|
||||
request_data = {
|
||||
"model": "test-model",
|
||||
"input": [
|
||||
|
||||
@@ -67,8 +67,7 @@ class TestResponseInputToHarmonyMessage:
|
||||
|
||||
def test_system_message(self):
|
||||
"""System messages carry developer instructions and must be rendered
|
||||
as developer messages with DeveloperContent.
|
||||
"""
|
||||
as developer messages with DeveloperContent."""
|
||||
msg = response_input_to_harmony(
|
||||
{"type": "message", "role": "system", "content": "Be helpful."},
|
||||
prev_responses=[],
|
||||
@@ -90,8 +89,7 @@ class TestResponseInputToHarmonyMessage:
|
||||
|
||||
def test_developer_message_gets_instructions_prefix(self):
|
||||
"""Developer messages must use DeveloperContent which adds the
|
||||
'# Instructions' header the model was trained on.
|
||||
"""
|
||||
'# Instructions' header the model was trained on."""
|
||||
msg = response_input_to_harmony(
|
||||
{"type": "message", "role": "developer", "content": "Be concise."},
|
||||
prev_responses=[],
|
||||
@@ -121,8 +119,7 @@ class TestResponseInputToHarmonyMessage:
|
||||
|
||||
def test_developer_message_array_content_concatenated(self):
|
||||
"""Array content in developer messages is flattened and rendered
|
||||
via DeveloperContent with the '# Instructions' header.
|
||||
"""
|
||||
via DeveloperContent with the '# Instructions' header."""
|
||||
msg = response_input_to_harmony(
|
||||
{
|
||||
"type": "message",
|
||||
@@ -213,8 +210,7 @@ class TestResponseInputToHarmonyMessage:
|
||||
|
||||
def test_function_call_output_uses_most_recent_matching_call(self):
|
||||
"""When multiple prev_responses share a call_id, the last one wins
|
||||
because the search is reversed.
|
||||
"""
|
||||
because the search is reversed."""
|
||||
earlier = ResponseFunctionToolCall(
|
||||
id="fc_old",
|
||||
call_id="call_test",
|
||||
|
||||
@@ -839,13 +839,11 @@ class TestConstructChatMessagesCombinePolicy:
|
||||
|
||||
class TestConstructInputMessagesInstructionsLeak:
|
||||
"""Regression tests for #37697: instructions from a prior response
|
||||
should NOT leak through previous_response_id.
|
||||
"""
|
||||
should NOT leak through previous_response_id."""
|
||||
|
||||
def test_old_instructions_stripped_from_prev_msg(self):
|
||||
"""System message in prev_msg must be dropped so the new request's
|
||||
instructions are the only system message in the conversation.
|
||||
"""
|
||||
instructions are the only system message in the conversation."""
|
||||
prev = [
|
||||
{"role": "system", "content": "old instructions"},
|
||||
{"role": "user", "content": "What is 2+2?"},
|
||||
@@ -862,8 +860,7 @@ class TestConstructInputMessagesInstructionsLeak:
|
||||
|
||||
def test_no_instructions_in_new_request(self):
|
||||
"""If the new request has no instructions, old ones should still
|
||||
be stripped -- they must not carry over.
|
||||
"""
|
||||
be stripped -- they must not carry over."""
|
||||
prev = [
|
||||
{"role": "system", "content": "old instructions"},
|
||||
{"role": "user", "content": "Hi"},
|
||||
|
||||
@@ -1163,8 +1163,7 @@ class TestHarmonyPreambleStreaming:
|
||||
|
||||
def test_preamble_done_emits_text_done_events(self) -> None:
|
||||
"""Completed preamble should emit text done + content_part done +
|
||||
output_item done, same shape as final channel.
|
||||
"""
|
||||
output_item done, same shape as final channel."""
|
||||
from vllm.entrypoints.openai.responses.streaming_events import (
|
||||
emit_previous_item_done_events,
|
||||
)
|
||||
@@ -1185,8 +1184,7 @@ class TestHarmonyPreambleStreaming:
|
||||
|
||||
def test_commentary_with_recipient_no_preamble_done(self) -> None:
|
||||
"""Commentary + recipient='functions.X' should route to function call
|
||||
done, not preamble done.
|
||||
"""
|
||||
done, not preamble done."""
|
||||
from vllm.entrypoints.openai.responses.streaming_events import (
|
||||
emit_previous_item_done_events,
|
||||
)
|
||||
@@ -1332,8 +1330,7 @@ def _mock_parser_with_reasoning(serving, delta_sequence: list[DeltaMessage]):
|
||||
class TestStreamingReasoningToContentTransition:
|
||||
"""Tests for _process_simple_streaming_events reasoning-to-content
|
||||
transition, specifically the fix for mixed deltas that carry both
|
||||
reasoning and content simultaneously.
|
||||
"""
|
||||
reasoning and content simultaneously."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_mixed_delta_reasoning_and_content_emits_reasoning_delta(
|
||||
@@ -1343,8 +1340,7 @@ class TestStreamingReasoningToContentTransition:
|
||||
and content set (e.g. reasoning end and content start in the same
|
||||
chunk), the trailing reasoning text must be emitted as a
|
||||
ResponseReasoningTextDeltaEvent and included in the
|
||||
ResponseReasoningTextDoneEvent text.
|
||||
"""
|
||||
ResponseReasoningTextDoneEvent text."""
|
||||
monkeypatch.setattr(envs, "VLLM_USE_EXPERIMENTAL_PARSER_CONTEXT", False)
|
||||
serving = _make_serving_instance_with_reasoning()
|
||||
|
||||
@@ -1413,8 +1409,7 @@ class TestStreamingReasoningToContentTransition:
|
||||
self, monkeypatch
|
||||
):
|
||||
"""When the transition from reasoning to content is clean (no mixed
|
||||
delta), no extra reasoning delta event should be emitted.
|
||||
"""
|
||||
delta), no extra reasoning delta event should be emitted."""
|
||||
monkeypatch.setattr(envs, "VLLM_USE_EXPERIMENTAL_PARSER_CONTEXT", False)
|
||||
serving = _make_serving_instance_with_reasoning()
|
||||
|
||||
@@ -1475,8 +1470,7 @@ class TestStreamingReasoningToContentTransition:
|
||||
async def test_reasoning_only_stream_no_content(self, monkeypatch):
|
||||
"""When the stream has only reasoning deltas and no content, the
|
||||
reasoning done event should be emitted at finalization with the
|
||||
full accumulated text, and no text delta events should appear.
|
||||
"""
|
||||
full accumulated text, and no text delta events should appear."""
|
||||
monkeypatch.setattr(envs, "VLLM_USE_EXPERIMENTAL_PARSER_CONTEXT", False)
|
||||
serving = _make_serving_instance_with_reasoning()
|
||||
|
||||
|
||||
@@ -143,8 +143,7 @@ async def test_streaming_output_consistency(client: OpenAI, model_name: str):
|
||||
@pytest.mark.parametrize("model_name", [MODEL_NAME])
|
||||
async def test_streaming_logprobs(client: OpenAI, model_name: str):
|
||||
"""Test that streaming with logprobs returns valid logprob data on
|
||||
output_text.delta events and that top_logprobs has the requested count.
|
||||
"""
|
||||
output_text.delta events and that top_logprobs has the requested count."""
|
||||
response = await client.responses.create(
|
||||
model=model_name,
|
||||
input="Say hello.",
|
||||
|
||||
@@ -124,8 +124,7 @@ class TestProcessorCompoundDeltas:
|
||||
|
||||
def test_split_name_and_args_same_index(self):
|
||||
"""Regression: parsers like KimiK2 emit name and args as separate
|
||||
DeltaToolCalls at the same index within one DeltaMessage.
|
||||
"""
|
||||
DeltaToolCalls at the same index within one DeltaMessage."""
|
||||
tc_name = _make_tool_call(0, name="get_weather")
|
||||
tc_args = _make_tool_call(0, arguments='{"city":"SF"}')
|
||||
delta = DeltaMessage(tool_calls=[tc_name, tc_args])
|
||||
@@ -141,8 +140,7 @@ class TestProcessorCompoundDeltas:
|
||||
|
||||
def test_reasoning_to_content_transition(self):
|
||||
"""Regression: the old special case in emit_delta handled this;
|
||||
now split_delta handles it generically.
|
||||
"""
|
||||
now split_delta handles it generically."""
|
||||
processor = SimpleStreamingEventProcessor()
|
||||
_run_through_processor(processor, DeltaMessage(reasoning="think"))
|
||||
assert processor.state.current_state == _StateType.REASONING
|
||||
|
||||
Reference in New Issue
Block a user