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
@@ -51,7 +51,8 @@ async def generate_mock_outputs(
|
||||
num_turns, prompt_token_counts, output_token_counts, cached_token_counts=None
|
||||
):
|
||||
"""Generate a sequence of mock RequestOutput objects to simulate multiple
|
||||
turns."""
|
||||
turns.
|
||||
"""
|
||||
if cached_token_counts is None:
|
||||
cached_token_counts = [0] * num_turns
|
||||
|
||||
@@ -270,7 +271,8 @@ def test_reasoning_tokens_counting():
|
||||
|
||||
def test_preamble_tokens_not_counted_as_reasoning():
|
||||
"""Preambles (commentary with no recipient) are visible user text,
|
||||
not hidden reasoning. They must NOT inflate num_reasoning_tokens."""
|
||||
not hidden reasoning. They must NOT inflate num_reasoning_tokens.
|
||||
"""
|
||||
context, parser = make_harmony_context()
|
||||
parser.enqueue_chunk_result(reasoning_token_count=0)
|
||||
|
||||
@@ -287,7 +289,8 @@ def test_preamble_tokens_not_counted_as_reasoning():
|
||||
|
||||
def test_commentary_with_recipient_counted_as_reasoning():
|
||||
"""Commentary directed at a tool (recipient != None) is hidden from
|
||||
the user, so it should still count as reasoning tokens."""
|
||||
the user, so it should still count as reasoning tokens.
|
||||
"""
|
||||
context, parser = make_harmony_context()
|
||||
parser.enqueue_chunk_result(reasoning_token_count=3)
|
||||
|
||||
@@ -346,7 +349,8 @@ async def test_single_turn_no_tool_output():
|
||||
@pytest.mark.asyncio
|
||||
async def test_negative_tool_tokens_edge_case():
|
||||
"""Test edge case where calculation could result in negative tool
|
||||
tokens. We should log an error and clamp the value to 0."""
|
||||
tokens. We should log an error and clamp the value to 0.
|
||||
"""
|
||||
# Use patch to check if logger.error was called
|
||||
with patch("vllm.entrypoints.openai.responses.context.logger.error") as mock_log:
|
||||
context, _ = make_harmony_context(available_tools=["browser"])
|
||||
@@ -544,7 +548,6 @@ async def test_streaming_multi_turn_token_counting():
|
||||
@pytest.mark.asyncio
|
||||
async def test_streaming_message_synchronization():
|
||||
"""Completed messages from append-local and flush segments sync into context."""
|
||||
|
||||
# Create a streaming context with some initial messages
|
||||
initial_messages = [
|
||||
Message(
|
||||
@@ -687,7 +690,8 @@ def create_simple_context_output(
|
||||
finished=True,
|
||||
):
|
||||
"""Helper to create a RequestOutput with customizable text for
|
||||
SimpleContext tests."""
|
||||
SimpleContext tests.
|
||||
"""
|
||||
if token_ids is None:
|
||||
token_ids = []
|
||||
return RequestOutput(
|
||||
@@ -871,7 +875,8 @@ def test_simple_context_final_output():
|
||||
|
||||
def test_simple_context_output_messages_empty_text_with_tokens():
|
||||
"""output_messages should be returned when tokens exist even if text is
|
||||
empty (e.g. special tokens)."""
|
||||
empty (e.g. special tokens).
|
||||
"""
|
||||
context = SimpleContext()
|
||||
context.append_output(
|
||||
create_simple_context_output(
|
||||
@@ -889,7 +894,8 @@ def test_simple_context_output_messages_empty_text_with_tokens():
|
||||
|
||||
def test_simple_context_output_messages_no_mutation():
|
||||
"""Each call to output_messages returns a fresh list; callers can't
|
||||
corrupt internal state."""
|
||||
corrupt internal state.
|
||||
"""
|
||||
context = SimpleContext()
|
||||
context.append_output(
|
||||
create_simple_context_output(
|
||||
|
||||
Reference in New Issue
Block a user