Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -36,11 +36,13 @@ def test_should_include_usage_force_enables_continuous_usage(stream_options, exp
|
||||
class TestGetMaxTokens:
|
||||
"""Tests for get_max_tokens() to ensure generation_config's max_tokens
|
||||
acts as a default when from model author, and as a ceiling when
|
||||
explicitly set by the user."""
|
||||
explicitly set by the user.
|
||||
"""
|
||||
|
||||
def test_default_sampling_params_used_when_no_request_max_tokens(self):
|
||||
"""When user doesn't specify max_tokens, generation_config default
|
||||
should apply."""
|
||||
should apply.
|
||||
"""
|
||||
result = get_max_tokens(
|
||||
max_model_len=24000,
|
||||
max_tokens=None,
|
||||
@@ -51,7 +53,8 @@ class TestGetMaxTokens:
|
||||
|
||||
def test_request_max_tokens_not_capped_by_default_sampling_params(self):
|
||||
"""When user specifies max_tokens in request, model author's
|
||||
generation_config max_tokens must NOT cap it (fixes #34005)."""
|
||||
generation_config max_tokens must NOT cap it (fixes #34005).
|
||||
"""
|
||||
result = get_max_tokens(
|
||||
max_model_len=24000,
|
||||
max_tokens=5000,
|
||||
@@ -94,7 +97,8 @@ class TestGetMaxTokens:
|
||||
|
||||
def test_request_max_tokens_smaller_than_default(self):
|
||||
"""When user explicitly requests fewer tokens than gen_config default,
|
||||
that should be respected."""
|
||||
that should be respected.
|
||||
"""
|
||||
result = get_max_tokens(
|
||||
max_model_len=24000,
|
||||
max_tokens=512,
|
||||
|
||||
@@ -239,7 +239,8 @@ def test_request_logger_log_outputs_integration():
|
||||
|
||||
def test_streaming_complete_logs_full_text_content():
|
||||
"""Test that streaming complete logging includes
|
||||
full accumulated text, not just token count."""
|
||||
full accumulated text, not just token count.
|
||||
"""
|
||||
mock_logger = MagicMock()
|
||||
|
||||
with patch("vllm.entrypoints.serve.utils.request_logger.logger", mock_logger):
|
||||
|
||||
@@ -17,7 +17,8 @@ from vllm.entrypoints.serve.utils.sse_keep_alive import (
|
||||
def test_disabled_returns_same_generator():
|
||||
"""For 0, negative, and NaN intervals the exact same generator object must
|
||||
be returned (identity), proving no wrapper or per-chunk overhead when
|
||||
disabled."""
|
||||
disabled.
|
||||
"""
|
||||
|
||||
async def gen():
|
||||
yield "x"
|
||||
@@ -33,7 +34,8 @@ def test_disabled_returns_same_generator():
|
||||
@pytest.mark.asyncio
|
||||
async def test_keep_alive_during_silent_start():
|
||||
"""A silent start (queue wait / prefill) emits keep-alive comments before
|
||||
the first real chunk."""
|
||||
the first real chunk.
|
||||
"""
|
||||
release = asyncio.Event()
|
||||
|
||||
async def gen():
|
||||
@@ -55,7 +57,8 @@ async def test_keep_alive_during_silent_start():
|
||||
@pytest.mark.asyncio
|
||||
async def test_no_keep_alive_when_streaming_is_fast():
|
||||
"""If chunks arrive faster than the interval, no comment is emitted and all
|
||||
data is forwarded."""
|
||||
data is forwarded.
|
||||
"""
|
||||
|
||||
async def gen():
|
||||
for chunk in ["a", "b", "c"]:
|
||||
@@ -69,7 +72,8 @@ async def test_no_keep_alive_when_streaming_is_fast():
|
||||
@pytest.mark.asyncio
|
||||
async def test_keep_alive_between_chunks_does_not_drop_data():
|
||||
"""Keep-alives interleaved with real chunks must never drop or reorder
|
||||
data."""
|
||||
data.
|
||||
"""
|
||||
release_b = asyncio.Event()
|
||||
release_c = asyncio.Event()
|
||||
|
||||
@@ -135,7 +139,8 @@ async def test_upstream_cancelled_error_propagates():
|
||||
@pytest.mark.asyncio
|
||||
async def test_aclose_closes_upstream():
|
||||
"""Closing a wrapper that is mid-stream must complete promptly and close
|
||||
the upstream generator (regression for the earlier leaked-task hang)."""
|
||||
the upstream generator (regression for the earlier leaked-task hang).
|
||||
"""
|
||||
finalized = asyncio.Event()
|
||||
|
||||
async def gen():
|
||||
@@ -154,7 +159,8 @@ async def test_aclose_closes_upstream():
|
||||
@pytest.mark.asyncio
|
||||
async def test_client_disconnect_cancels_upstream():
|
||||
"""Cancelling the consumer mid-stream must cancel the pending anext and
|
||||
close the upstream generator so its cleanup runs."""
|
||||
close the upstream generator so its cleanup runs.
|
||||
"""
|
||||
finalized = asyncio.Event()
|
||||
|
||||
async def gen():
|
||||
@@ -181,7 +187,8 @@ async def test_client_disconnect_cancels_upstream():
|
||||
@pytest.mark.asyncio
|
||||
async def test_streaming_response_emits_comment():
|
||||
"""A keep-alive comment must reach the client through the real
|
||||
StreamingResponse used by the routers."""
|
||||
StreamingResponse used by the routers.
|
||||
"""
|
||||
release = asyncio.Event()
|
||||
|
||||
async def gen():
|
||||
@@ -220,7 +227,8 @@ async def test_streaming_response_emits_comment():
|
||||
async def test_streaming_response_disconnect_closes_upstream():
|
||||
"""On the ASGI 2.3 disconnect path used by the pinned Uvicorn, Starlette
|
||||
cancels streaming and the wrapper's finally must close the upstream
|
||||
generator."""
|
||||
generator.
|
||||
"""
|
||||
finalized = asyncio.Event()
|
||||
|
||||
async def gen():
|
||||
|
||||
Reference in New Issue
Block a user