mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
test: Add tests for /model command edit_format behavior
This commit is contained in:
parent
5516e6b279
commit
2adfe1507b
1 changed files with 21 additions and 0 deletions
|
@ -1682,6 +1682,27 @@ class TestCommands(TestCase):
|
|||
self.assertEqual(
|
||||
context.exception.kwargs.get("main_model").weak_model.name, self.GPT35.weak_model.name
|
||||
)
|
||||
# Check that the edit format is updated to the new model's default
|
||||
self.assertEqual(context.exception.kwargs.get("edit_format"), "whole")
|
||||
|
||||
def test_cmd_model_preserves_explicit_edit_format(self):
|
||||
io = InputOutput(pretty=False, fancy_input=False, yes=True)
|
||||
# Use gpt-3.5-turbo (default 'diff')
|
||||
coder = Coder.create(self.GPT35, None, io)
|
||||
# Explicitly set edit format to something else
|
||||
coder.edit_format = "udiff"
|
||||
commands = Commands(io, coder)
|
||||
|
||||
# Mock sanity check to avoid network calls
|
||||
with mock.patch("aider.models.sanity_check_models"):
|
||||
# Test switching the main model to gpt-4 (default 'whole')
|
||||
with self.assertRaises(SwitchCoder) as context:
|
||||
commands.cmd_model("gpt-4")
|
||||
|
||||
# Check that the SwitchCoder exception contains the correct model configuration
|
||||
self.assertEqual(context.exception.kwargs.get("main_model").name, "gpt-4")
|
||||
# Check that the edit format is preserved
|
||||
self.assertEqual(context.exception.kwargs.get("edit_format"), "udiff")
|
||||
|
||||
def test_cmd_editor_model(self):
|
||||
io = InputOutput(pretty=False, fancy_input=False, yes=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue