mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
test: simplify deprecated model flag tests
This commit is contained in:
parent
4c35f88ea0
commit
d30b9d1513
1 changed files with 7 additions and 9 deletions
|
@ -6,6 +6,7 @@ from prompt_toolkit.input import DummyInput
|
||||||
from prompt_toolkit.output import DummyOutput
|
from prompt_toolkit.output import DummyOutput
|
||||||
|
|
||||||
from aider.deprecated import handle_deprecated_model_args
|
from aider.deprecated import handle_deprecated_model_args
|
||||||
|
from aider.dump import dump # noqa
|
||||||
from aider.main import main
|
from aider.main import main
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,8 +55,11 @@ class TestDeprecated(TestCase):
|
||||||
|
|
||||||
# Look for the deprecation warning in all calls
|
# Look for the deprecation warning in all calls
|
||||||
deprecation_warning = None
|
deprecation_warning = None
|
||||||
|
dump(flag)
|
||||||
|
dump(mock_tool_warning.call_args_list)
|
||||||
for call_args in mock_tool_warning.call_args_list:
|
for call_args in mock_tool_warning.call_args_list:
|
||||||
if flag.lstrip("-") in call_args[0][0] and "deprecated" in call_args[0][0]:
|
dump(call_args)
|
||||||
|
if "deprecated" in call_args[0][0]:
|
||||||
deprecation_warning = call_args[0][0]
|
deprecation_warning = call_args[0][0]
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -64,10 +68,6 @@ class TestDeprecated(TestCase):
|
||||||
)
|
)
|
||||||
warning_msg = deprecation_warning
|
warning_msg = deprecation_warning
|
||||||
|
|
||||||
# Remove any leading hyphens for the comparison
|
|
||||||
flag_in_msg = flag.lstrip("-")
|
|
||||||
|
|
||||||
self.assertIn(flag_in_msg, warning_msg)
|
|
||||||
self.assertIn("deprecated", warning_msg)
|
self.assertIn("deprecated", warning_msg)
|
||||||
self.assertIn("use --model", warning_msg.lower())
|
self.assertIn("use --model", warning_msg.lower())
|
||||||
|
|
||||||
|
@ -104,20 +104,18 @@ class TestDeprecated(TestCase):
|
||||||
("haiku", "claude-3-5-haiku-20241022"),
|
("haiku", "claude-3-5-haiku-20241022"),
|
||||||
("4", "gpt-4-0613"),
|
("4", "gpt-4-0613"),
|
||||||
# Testing the dash variant with underscore in attribute name
|
# Testing the dash variant with underscore in attribute name
|
||||||
("_4", "gpt-4-0613"),
|
|
||||||
("4o", "gpt-4o"),
|
("4o", "gpt-4o"),
|
||||||
("mini", "gpt-4o-mini"),
|
("mini", "gpt-4o-mini"),
|
||||||
("4_turbo", "gpt-4-1106-preview"),
|
("4_turbo", "gpt-4-1106-preview"),
|
||||||
("35turbo", "gpt-3.5-turbo"),
|
|
||||||
("35_turbo", "gpt-3.5-turbo"),
|
("35_turbo", "gpt-3.5-turbo"),
|
||||||
("3", "gpt-3.5-turbo"),
|
|
||||||
("_3", "gpt-3.5-turbo"),
|
|
||||||
("deepseek", "deepseek/deepseek-chat"),
|
("deepseek", "deepseek/deepseek-chat"),
|
||||||
("o1_mini", "o1-mini"),
|
("o1_mini", "o1-mini"),
|
||||||
("o1_preview", "o1-preview"),
|
("o1_preview", "o1-preview"),
|
||||||
]
|
]
|
||||||
|
|
||||||
for flag, expected_model in test_cases:
|
for flag, expected_model in test_cases:
|
||||||
|
print(flag, expected_model)
|
||||||
|
|
||||||
with self.subTest(flag=flag):
|
with self.subTest(flag=flag):
|
||||||
# Create a mock IO instance
|
# Create a mock IO instance
|
||||||
mock_io = MagicMock()
|
mock_io = MagicMock()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue