[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
@@ -465,8 +465,7 @@ def test_system_message_warns_on_video(video_content):
|
||||
def test_json_schema_response_format_missing_schema():
|
||||
"""When response_format type is 'json_schema' but the json_schema field
|
||||
is not provided, request construction should raise a validation error
|
||||
so the API returns 400 instead of 500.
|
||||
"""
|
||||
so the API returns 400 instead of 500."""
|
||||
with pytest.raises(Exception, match="json_schema.*must be provided"):
|
||||
ChatCompletionRequest(
|
||||
model=MODEL_NAME,
|
||||
@@ -520,8 +519,7 @@ def test_structured_outputs_structural_tag_invalid(structural_tag):
|
||||
@pytest.mark.parametrize("field_name", ["prompt_logprobs", "top_logprobs"])
|
||||
def test_non_numeric_logprobs_rejected(field_name):
|
||||
"""A non-numeric logprobs value must be a clean 400 validation error, not a
|
||||
TypeError from the mode='before' comparison (which surfaces as HTTP 500).
|
||||
"""
|
||||
TypeError from the mode='before' comparison (which surfaces as HTTP 500)."""
|
||||
with pytest.raises(VLLMValidationError, match=f"`{field_name}` must be an integer"):
|
||||
ChatCompletionRequest(
|
||||
model=MODEL_NAME,
|
||||
|
||||
@@ -81,8 +81,7 @@ async def test_chat_logit_bias_invalid(client):
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_logit_bias_non_integer_key(client):
|
||||
"""Test that a non-integer logit_bias key is rejected with a clean,
|
||||
informative error instead of a raw 'invalid literal for int()' message.
|
||||
"""
|
||||
informative error instead of a raw 'invalid literal for int()' message."""
|
||||
with pytest.raises(openai.BadRequestError) as excinfo:
|
||||
await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
@@ -102,8 +101,7 @@ async def test_chat_logit_bias_non_integer_key(client):
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_logit_bias_non_numeric_value(client):
|
||||
"""Test that a non-numeric logit_bias value is rejected with a message
|
||||
that names the specific offending token, not just a generic TypeError.
|
||||
"""
|
||||
that names the specific offending token, not just a generic TypeError."""
|
||||
with pytest.raises(openai.BadRequestError) as excinfo:
|
||||
await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
@@ -122,8 +120,7 @@ async def test_chat_logit_bias_non_numeric_value(client):
|
||||
@pytest.mark.asyncio
|
||||
async def test_chat_logit_bias_multiple_non_integer_keys(client):
|
||||
"""Test that ALL invalid logit_bias keys are reported together,
|
||||
not just the first one encountered.
|
||||
"""
|
||||
not just the first one encountered."""
|
||||
with pytest.raises(openai.BadRequestError) as excinfo:
|
||||
await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
|
||||
@@ -54,8 +54,7 @@ def stop_sign_image_url():
|
||||
async def test_translategemma_extra_lang_code_fields(client: openai.AsyncOpenAI):
|
||||
"""En -> es translation through TranslateGemma's bundled chat template's
|
||||
``text`` content branch, which depends on ``source_lang_code`` /
|
||||
``target_lang_code`` extra fields being preserved on the content part.
|
||||
"""
|
||||
``target_lang_code`` extra fields being preserved on the content part."""
|
||||
completion = await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
messages=[
|
||||
@@ -99,8 +98,7 @@ async def test_translategemma_image_extra_lang_code_fields(
|
||||
``source_lang_code`` / ``target_lang_code`` extras must survive parsing
|
||||
and end up alongside the ``{"type": "image"}`` placeholder so the
|
||||
template's image branch (``content["type"] == 'image'``) renders the
|
||||
right OCR-translation prompt.
|
||||
"""
|
||||
right OCR-translation prompt."""
|
||||
completion = await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
messages=[
|
||||
|
||||
@@ -191,8 +191,7 @@ async def test_logprob_token_ids_stream_with_no_top_k(server):
|
||||
async def test_logprob_token_ids_default_behavior_unchanged(server):
|
||||
"""Without `logprob_token_ids`, the response carries the natural top-k
|
||||
most-likely tokens. This guards against the new field accidentally
|
||||
changing the default-path output.
|
||||
"""
|
||||
changing the default-path output."""
|
||||
async with server.get_async_client() as client:
|
||||
resp = await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
|
||||
@@ -1406,8 +1406,7 @@ async def test_serving_chat_did_set_correct_cache_salt(model_type):
|
||||
@pytest.mark.asyncio
|
||||
async def test_serving_chat_data_parallel_rank_extraction():
|
||||
"""Test that data_parallel_rank is properly extracted from header and
|
||||
passed to engine.
|
||||
"""
|
||||
passed to engine."""
|
||||
mock_engine = MagicMock(spec=AsyncLLM)
|
||||
mock_engine.errored = False
|
||||
mock_engine.model_config = MockModelConfig()
|
||||
@@ -1729,8 +1728,7 @@ class TestServingChatWithHarmony:
|
||||
@pytest.mark.asyncio
|
||||
async def test_system_message_without_tools(self, serving_chat, stream):
|
||||
"""Leading system message produces a developer message with
|
||||
DeveloperContent (# Instructions header).
|
||||
"""
|
||||
DeveloperContent (# Instructions header)."""
|
||||
messages = [
|
||||
{"role": "system", "content": "You are a helpful assistant."},
|
||||
{"role": "user", "content": "Hello"},
|
||||
@@ -1752,8 +1750,7 @@ class TestServingChatWithHarmony:
|
||||
@pytest.mark.asyncio
|
||||
async def test_system_message_with_tools(self, serving_chat, stream, weather_tools):
|
||||
"""Leading system message is folded into the developer message
|
||||
alongside tool definitions.
|
||||
"""
|
||||
alongside tool definitions."""
|
||||
messages = [
|
||||
{"role": "system", "content": "You are a helpful assistant."},
|
||||
{"role": "user", "content": "What's the weather?"},
|
||||
@@ -2168,8 +2165,7 @@ class TestServingChatWithHarmony:
|
||||
@pytest.mark.asyncio
|
||||
async def test_tool_choice_validation_without_parser():
|
||||
"""Test that tool_choice='required' or named tool without tool_parser
|
||||
returns an appropriate error message.
|
||||
"""
|
||||
returns an appropriate error message."""
|
||||
mock_engine = MagicMock(spec=AsyncLLM)
|
||||
mock_engine.errored = False
|
||||
mock_engine.model_config = MockModelConfig()
|
||||
|
||||
@@ -151,8 +151,7 @@ async def client(request, server, server_with_auto_reasoning_config):
|
||||
@pytest.mark.parametrize("client", ["default", "auto_config"], indirect=True)
|
||||
async def test_thinking_token_budget_mixed_requests(client: openai.AsyncOpenAI):
|
||||
"""Test that mixed requests (some with thinking_token_budget, some without)
|
||||
complete successfully without errors.
|
||||
"""
|
||||
complete successfully without errors."""
|
||||
response_with_budget = await client.chat.completions.create(
|
||||
model=MODEL_NAME,
|
||||
messages=MESSAGES,
|
||||
|
||||
Reference in New Issue
Block a user