fix: Move mock_send_side_effect definition before its usage

This commit is contained in:
Paul Gauthier 2024-08-01 15:42:43 -03:00 committed by Paul Gauthier (aider)
parent 58a732312b
commit 8a6f1337f6

View file

@ -10,11 +10,6 @@ class TestScriptingAPI(unittest.TestCase):
@patch("aider.coders.base_coder.Coder.send")
def test_basic_scripting(self, mock_send):
# Setup
def mock_send_side_effect(messages):
coder.partial_response_content = "Changes applied successfully."
return "Changes applied successfully."
mock_send.side_effect = mock_send_side_effect
# Test script
fnames = ["greeting.py"]
@ -24,6 +19,12 @@ class TestScriptingAPI(unittest.TestCase):
result1 = coder.run("make a script that prints hello world")
result2 = coder.run("make it say goodbye")
def mock_send_side_effect(messages):
coder.partial_response_content = "Changes applied successfully."
return "Changes applied successfully."
mock_send.side_effect = mock_send_side_effect
# Assertions
self.assertEqual(mock_send.call_count, 2)
mock_send.assert_any_call(