style: Format code with linter and remove trailing whitespaces

This commit is contained in:
Paul Gauthier (aider) 2025-03-07 17:03:21 -08:00
parent 16d7cf7a52
commit c53833072f

View file

@ -91,14 +91,14 @@ class TestReasoning(unittest.TestCase):
self.choices[0].delta.content = content self.choices[0].delta.content = content
else: else:
# Need to handle attribute access that would raise AttributeError # Need to handle attribute access that would raise AttributeError
delattr(self.choices[0].delta, 'content') delattr(self.choices[0].delta, "content")
# Set reasoning_content if provided # Set reasoning_content if provided
if reasoning_content is not None: if reasoning_content is not None:
self.choices[0].delta.reasoning_content = reasoning_content self.choices[0].delta.reasoning_content = reasoning_content
else: else:
# Need to handle attribute access that would raise AttributeError # Need to handle attribute access that would raise AttributeError
delattr(self.choices[0].delta, 'reasoning_content') delattr(self.choices[0].delta, "reasoning_content")
# Create chunks to simulate streaming # Create chunks to simulate streaming
chunks = [ chunks = [
@ -112,7 +112,7 @@ class TestReasoning(unittest.TestCase):
MockStreamingChunk(content="answer "), MockStreamingChunk(content="answer "),
MockStreamingChunk(content="after reasoning"), MockStreamingChunk(content="after reasoning"),
# End the response # End the response
MockStreamingChunk(finish_reason="stop") MockStreamingChunk(finish_reason="stop"),
] ]
# Create a mock hash object # Create a mock hash object
@ -130,7 +130,7 @@ class TestReasoning(unittest.TestCase):
# Check the arguments of the final call to update # Check the arguments of the final call to update
final_call = mock_mdstream.update.call_args_list[-1] final_call = mock_mdstream.update.call_args_list[-1]
self.assertTrue(final_call[1]['final']) self.assertTrue(final_call[1]["final"])
final_text = final_call[0][0] final_text = final_call[0][0]
# The final text should include both reasoning and main content with proper formatting # The final text should include both reasoning and main content with proper formatting
@ -142,7 +142,9 @@ class TestReasoning(unittest.TestCase):
# Ensure proper order: reasoning first, then main content # Ensure proper order: reasoning first, then main content
reasoning_pos = final_text.find("My step-by-step reasoning process") reasoning_pos = final_text.find("My step-by-step reasoning process")
main_pos = final_text.find("Final answer after reasoning") main_pos = final_text.find("Final answer after reasoning")
self.assertLess(reasoning_pos, main_pos, "Reasoning content should appear before main content") self.assertLess(
reasoning_pos, main_pos, "Reasoning content should appear before main content"
)
def test_send_with_think_tags(self): def test_send_with_think_tags(self):
"""Test that <think> tags are properly processed and formatted.""" """Test that <think> tags are properly processed and formatted."""