mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
test: Add tests for accepts_settings configuration and thinking_tokens option
This commit is contained in:
parent
182c06107f
commit
719324981d
1 changed files with 64 additions and 0 deletions
|
@ -684,6 +684,59 @@ class TestMain(TestCase):
|
|||
)
|
||||
self.assertTrue(coder.detect_urls)
|
||||
|
||||
def test_accepts_settings_warnings(self):
|
||||
# Test that appropriate warnings are shown based on accepts_settings configuration
|
||||
with GitTemporaryDirectory():
|
||||
# Test model that accepts the thinking_tokens setting
|
||||
with patch("aider.io.InputOutput.tool_warning") as mock_warning:
|
||||
main(
|
||||
["--model", "anthropic/claude-3-7-sonnet-20250219", "--thinking-tokens", "1000", "--yes", "--exit"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
# No warning should be shown as this model accepts thinking_tokens
|
||||
for call in mock_warning.call_args_list:
|
||||
self.assertNotIn("thinking_tokens", call[0][0])
|
||||
|
||||
# Test model that doesn't have accepts_settings for thinking_tokens
|
||||
with patch("aider.io.InputOutput.tool_warning") as mock_warning:
|
||||
main(
|
||||
["--model", "gpt-4o", "--thinking-tokens", "1000", "--yes", "--exit"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
# Warning should be shown
|
||||
warning_shown = False
|
||||
for call in mock_warning.call_args_list:
|
||||
if "thinking_tokens" in call[0][0]:
|
||||
warning_shown = True
|
||||
self.assertTrue(warning_shown)
|
||||
|
||||
# Test model that accepts the reasoning_effort setting
|
||||
with patch("aider.io.InputOutput.tool_warning") as mock_warning:
|
||||
main(
|
||||
["--model", "o1", "--reasoning-effort", "3", "--yes", "--exit"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
# No warning should be shown as this model accepts reasoning_effort
|
||||
for call in mock_warning.call_args_list:
|
||||
self.assertNotIn("reasoning_effort", call[0][0])
|
||||
|
||||
# Test model that doesn't have accepts_settings for reasoning_effort
|
||||
with patch("aider.io.InputOutput.tool_warning") as mock_warning:
|
||||
main(
|
||||
["--model", "gpt-3.5-turbo", "--reasoning-effort", "3", "--yes", "--exit"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
# Warning should be shown
|
||||
warning_shown = False
|
||||
for call in mock_warning.call_args_list:
|
||||
if "reasoning_effort" in call[0][0]:
|
||||
warning_shown = True
|
||||
self.assertTrue(warning_shown)
|
||||
|
||||
@patch("aider.models.ModelInfoManager.set_verify_ssl")
|
||||
def test_no_verify_ssl_sets_model_info_manager(self, mock_set_verify_ssl):
|
||||
with GitTemporaryDirectory():
|
||||
|
@ -943,3 +996,14 @@ class TestMain(TestCase):
|
|||
self.assertEqual(
|
||||
coder.main_model.extra_params.get("extra_body", {}).get("reasoning_effort"), "3"
|
||||
)
|
||||
|
||||
def test_thinking_tokens_option(self):
|
||||
coder = main(
|
||||
["--thinking-tokens", "1000", "--yes", "--exit"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
return_coder=True,
|
||||
)
|
||||
self.assertEqual(
|
||||
coder.main_model.extra_params.get("extra_body", {}).get("thinking_tokens"), "1000"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue