MCPcopy
hub / github.com/Aider-AI/aider / test_get_commit_message

Method test_get_commit_message

tests/basic/test_repo.py:132–153  ·  view source on GitHub ↗
(self, mock_send)

Source from the content-addressed store, hash-verified

130
131 @patch("aider.models.Model.simple_send_with_retries")
132 def test_get_commit_message(self, mock_send):
133 mock_send.side_effect = ["", "a good commit message"]
134
135 model1 = Model("gpt-3.5-turbo")
136 model2 = Model("gpt-4")
137 dump(model1)
138 dump(model2)
139 repo = GitRepo(InputOutput(), None, None, models=[model1, model2])
140
141 # Call the get_commit_message method with dummy diff and context
142 result = repo.get_commit_message("dummy diff", "dummy context")
143
144 # Assert that the returned message is the expected one from the second model
145 self.assertEqual(result, "a good commit message")
146
147 # Check that simple_send_with_retries was called twice
148 self.assertEqual(mock_send.call_count, 2)
149
150 # Check that both calls were made with the same messages
151 first_call_messages = mock_send.call_args_list[0][0][0] # Get messages from first call
152 second_call_messages = mock_send.call_args_list[1][0][0] # Get messages from second call
153 self.assertEqual(first_call_messages, second_call_messages)
154
155 @patch("aider.models.Model.simple_send_with_retries")
156 def test_get_commit_message_strip_quotes(self, mock_send):

Callers

nothing calls this directly

Calls 5

get_commit_messageMethod · 0.95
ModelClass · 0.90
dumpFunction · 0.90
GitRepoClass · 0.90
InputOutputClass · 0.90

Tested by

no test coverage detected