[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:
Harry Mellor
2026-09-16 10:57:24 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent 1085b64425
commit 651a88c09a
693 changed files with 2088 additions and 4171 deletions
@@ -241,8 +241,7 @@ class TestToolResultContent:
self, tool_result_content
) -> AnthropicMessagesRequest:
"""Build a request with assistant tool_use followed by user
tool_result.
"""
tool_result."""
return _make_request(
[
{
@@ -327,8 +326,7 @@ class TestToolResultContent:
def test_tool_result_with_text_and_image(self):
"""Mixed text+image tool_result: text in tool msg, image in user
msg.
"""
msg."""
request = self._make_tool_result_request(
[
{"type": "text", "text": "Here is the screenshot"},
@@ -425,8 +423,7 @@ class TestToolResultContent:
class TestAttributionHeaderStripping:
def test_billing_header_stripped_from_system(self):
"""Claude Code's x-anthropic-billing-header block should be
stripped to preserve prefix caching.
"""
stripped to preserve prefix caching."""
request = _make_request(
[{"role": "user", "content": "Hello"}],
system=[
@@ -1150,8 +1147,7 @@ class TestMessageStreamConverterToolUseContentBuffering:
async def test_buffered_content_flushed_on_done_without_usage_chunk(self):
"""Content buffered during tool_use must be emitted even if the
stream jumps straight from finish_reason to [DONE], skipping the
empty-choices usage chunk.
"""
empty-choices usage chunk."""
async def sse_input():
yield _make_stream_chunk(
@@ -1255,8 +1251,7 @@ class TestStreamingCacheUsageSemantics:
async def test_streaming_cache_fields_absent_then_populated(self):
"""First chunk lacks prompt_tokens_details (vLLM contract);
message_start omits cache fields. The final chunk carries
prompt_tokens_details, so message_delta carries resolved values.
"""
prompt_tokens_details, so message_delta carries resolved values."""
async def sse_input():
yield _make_stream_chunk(
@@ -1301,8 +1296,7 @@ class TestStreamingCacheUsageSemantics:
@pytest.mark.asyncio
async def test_streaming_no_cache_hit(self):
"""When the final chunk reports cached_tokens=0, message_delta carries
cache fields = 0 (cache miss); message_start still omits them.
"""
cache fields = 0 (cache miss); message_start still omits them."""
async def sse_input():
yield _make_stream_chunk(
@@ -1343,8 +1337,7 @@ class TestStreamingCacheUsageSemantics:
@pytest.mark.asyncio
async def test_streaming_no_prompt_tokens_details_at_all(self):
"""If --enable-prompt-tokens-details is off, no chunk carries cache
info; both message_start and message_delta omit cache fields.
"""
info; both message_start and message_delta omit cache fields."""
async def sse_input():
yield _make_stream_chunk(
@@ -1465,8 +1458,7 @@ class TestMessagesFullConverter:
class TestCacheSalt:
def test_cache_salt_passed_through(self):
"""cache_salt on the Anthropic request reaches the converted
ChatCompletionRequest so prefix-cache isolation works via /v1/messages.
"""
ChatCompletionRequest so prefix-cache isolation works via /v1/messages."""
request = _make_request(
[{"role": "user", "content": "Hello"}],
cache_salt="tenant-abc-secret-salt",
@@ -1671,8 +1663,7 @@ class TestClientErrorResponses:
@staticmethod
def _conversion_error() -> ValidationError:
"""A real pydantic ValidationError like the one ChatCompletionRequest
construction raises when Anthropic input violates the OpenAI schema.
"""
construction raises when Anthropic input violates the OpenAI schema."""
class _StubRequest(BaseModel):
stop: Annotated[list[str], Field(max_length=4)] | None = None
@@ -1683,8 +1674,7 @@ class TestClientErrorResponses:
def test_validation_error_returns_bad_request(self):
"""A pydantic ValidationError during Anthropic->OpenAI conversion is
surfaced as a 400 BadRequestError, not a 500.
"""
surfaced as a 400 BadRequestError, not a 500."""
handler = MagicMock(spec=AnthropicServingMessages)
handler.create_messages.side_effect = self._conversion_error()