[CI][RFC] Replace black-jupyter with ruff-format (#37210)

Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
Alex Nails
2026-09-02 19:46:08 -07:00
committed by GitHub
co-authored by Alison Shao
parent 2641e427be
commit 28262c20df
1411 changed files with 7766 additions and 8176 deletions
@@ -58,15 +58,15 @@ class TestStreamingEventsLocal:
first_item_event = output_item_added_events[0]
assert first_item_event.item is not None
assert first_item_event.output_index is not None
assert (
first_item_event.output_index == 0
), "First output item must have output_index: 0 (zero-based indexing)"
assert first_item_event.output_index == 0, (
"First output item must have output_index: 0 (zero-based indexing)"
)
# Verify subsequent items increment correctly
for i, event in enumerate(output_item_added_events):
assert (
event.output_index == i
), f"Output item {i} should have output_index: {i}"
assert event.output_index == i, (
f"Output item {i} should have output_index: {i}"
)
# Verify output_item.done event exists
output_item_done_events = [
@@ -101,9 +101,9 @@ class TestStreamingEventsLocal:
output_item_added_events = [
event for event in events if event.type == "response.output_item.added"
]
assert len(output_item_added_events) == len(
output_array
), "Number of output_item.added events should match output array length"
assert len(output_item_added_events) == len(output_array), (
"Number of output_item.added events should match output array length"
)
# =============================================================================
@@ -147,15 +147,15 @@ class TestStreamingEventsHarmony:
first_item_event = output_item_added_events[0]
assert first_item_event.item is not None
assert first_item_event.output_index is not None
assert (
first_item_event.output_index == 0
), "First output item must have output_index: 0 (zero-based indexing)"
assert first_item_event.output_index == 0, (
"First output item must have output_index: 0 (zero-based indexing)"
)
# Verify subsequent items increment correctly
for i, event in enumerate(output_item_added_events):
assert (
event.output_index == i
), f"Output item {i} should have output_index: {i}"
assert event.output_index == i, (
f"Output item {i} should have output_index: {i}"
)
# Verify output_item.done event exists
output_item_done_events = [
@@ -190,9 +190,9 @@ class TestStreamingEventsHarmony:
output_item_added_events = [
event for event in events if event.type == "response.output_item.added"
]
assert len(output_item_added_events) == len(
output_array
), "Number of output_item.added events should match output array length"
assert len(output_item_added_events) == len(output_array), (
"Number of output_item.added events should match output array length"
)
def test_reasoning_content(self, setup_backend):
"""Test that reasoning content has correct zero-based output_index.
@@ -228,16 +228,16 @@ class TestStreamingEventsHarmony:
# If reasoning is present, verify it has output_index: 0
if reasoning_items:
reasoning_item = reasoning_items[0]
assert (
reasoning_item.output_index == 0
), "Reasoning item should have output_index: 0"
assert reasoning_item.output_index == 0, (
"Reasoning item should have output_index: 0"
)
# If message is present after reasoning, verify it has output_index: 1
if reasoning_items and message_items:
message_item = message_items[0]
assert (
message_item.output_index == 1
), "Message item after reasoning should have output_index: 1"
assert message_item.output_index == 1, (
"Message item after reasoning should have output_index: 1"
)
# Find response.completed event
completed_events = [
@@ -168,9 +168,9 @@ class TestToolCallingCloud:
# Check for function_call in output
function_calls = [item for item in output if item.type == "function_call"]
assert (
len(function_calls) > 0
), "Response should contain at least one function_call"
assert len(function_calls) > 0, (
"Response should contain at least one function_call"
)
# Verify function_call structure
function_call = function_calls[0]
@@ -285,30 +285,30 @@ class TestToolCallingCloud:
event_types = [event.type for event in events]
assert "response.created" in event_types, "Should have response.created event"
assert (
"response.completed" in event_types
), "Should have response.completed event"
assert (
"response.output_item.added" in event_types
), "Should have output_item.added events"
assert (
"response.mcp_list_tools.in_progress" in event_types
), "Should have mcp_list_tools.in_progress event"
assert (
"response.mcp_list_tools.completed" in event_types
), "Should have mcp_list_tools.completed event"
assert (
"response.mcp_call.in_progress" in event_types
), "Should have mcp_call.in_progress event"
assert (
"response.mcp_call_arguments.delta" in event_types
), "Should have mcp_call_arguments.delta event"
assert (
"response.mcp_call_arguments.done" in event_types
), "Should have mcp_call_arguments.done event"
assert (
"response.mcp_call.completed" in event_types
), "Should have mcp_call.completed event"
assert "response.completed" in event_types, (
"Should have response.completed event"
)
assert "response.output_item.added" in event_types, (
"Should have output_item.added events"
)
assert "response.mcp_list_tools.in_progress" in event_types, (
"Should have mcp_list_tools.in_progress event"
)
assert "response.mcp_list_tools.completed" in event_types, (
"Should have mcp_list_tools.completed event"
)
assert "response.mcp_call.in_progress" in event_types, (
"Should have mcp_call.in_progress event"
)
assert "response.mcp_call_arguments.delta" in event_types, (
"Should have mcp_call_arguments.delta event"
)
assert "response.mcp_call_arguments.done" in event_types, (
"Should have mcp_call_arguments.done event"
)
assert "response.mcp_call.completed" in event_types, (
"Should have mcp_call.completed event"
)
completed_events = [e for e in events if e.type == "response.completed"]
assert len(completed_events) == 1
@@ -336,18 +336,18 @@ class TestToolCallingCloud:
assert mcp_call.output is not None
# Strict validation for cloud backends - check for text output events
assert (
"response.content_part.added" in event_types
), "Should have content_part.added event"
assert (
"response.output_text.delta" in event_types
), "Should have output_text.delta events"
assert (
"response.output_text.done" in event_types
), "Should have output_text.done event"
assert (
"response.content_part.done" in event_types
), "Should have content_part.done event"
assert "response.content_part.added" in event_types, (
"Should have content_part.added event"
)
assert "response.output_text.delta" in event_types, (
"Should have output_text.delta events"
)
assert "response.output_text.done" in event_types, (
"Should have output_text.done event"
)
assert "response.content_part.done" in event_types, (
"Should have content_part.done event"
)
assert "message" in final_output_types
@@ -400,9 +400,9 @@ class TestToolChoiceHarmony:
assert len(output) > 0
function_calls = [item for item in output if item.type == "function_call"]
assert (
len(function_calls) > 0
), "Model should choose to call function with tool_choice='auto'"
assert len(function_calls) > 0, (
"Model should choose to call function with tool_choice='auto'"
)
def test_tool_choice_required(self, setup_backend):
"""Test tool_choice="required" forces the model to call at least one tool."""
@@ -423,9 +423,9 @@ class TestToolChoiceHarmony:
output = resp.output
function_calls = [item for item in output if item.type == "function_call"]
assert (
len(function_calls) > 0
), "tool_choice='required' must force at least one function call"
assert len(function_calls) > 0, (
"tool_choice='required' must force at least one function call"
)
def test_tool_choice_specific_function(self, setup_backend):
"""Test tool_choice with specific function name forces that function to be called."""
@@ -447,9 +447,9 @@ class TestToolChoiceHarmony:
output = resp.output
function_calls = [item for item in output if item.type == "function_call"]
assert len(function_calls) > 0, "Must call the specified function"
assert (
function_calls[0].name == "search_web"
), "Must call the function specified in tool_choice"
assert function_calls[0].name == "search_web", (
"Must call the function specified in tool_choice"
)
def test_tool_choice_streaming(self, setup_backend):
"""Test tool_choice parameter works correctly with streaming."""