mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 12:55:00 +00:00
fix: Move mock_send_side_effect definition before its usage
This commit is contained in:
parent
58a732312b
commit
8a6f1337f6
1 changed files with 6 additions and 5 deletions
|
@ -10,11 +10,6 @@ class TestScriptingAPI(unittest.TestCase):
|
||||||
@patch("aider.coders.base_coder.Coder.send")
|
@patch("aider.coders.base_coder.Coder.send")
|
||||||
def test_basic_scripting(self, mock_send):
|
def test_basic_scripting(self, mock_send):
|
||||||
# Setup
|
# 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
|
# Test script
|
||||||
fnames = ["greeting.py"]
|
fnames = ["greeting.py"]
|
||||||
|
@ -24,6 +19,12 @@ class TestScriptingAPI(unittest.TestCase):
|
||||||
result1 = coder.run("make a script that prints hello world")
|
result1 = coder.run("make a script that prints hello world")
|
||||||
result2 = coder.run("make it say goodbye")
|
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
|
# Assertions
|
||||||
self.assertEqual(mock_send.call_count, 2)
|
self.assertEqual(mock_send.call_count, 2)
|
||||||
mock_send.assert_any_call(
|
mock_send.assert_any_call(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue