mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
style: Fix whitespace and formatting in test file
This commit is contained in:
parent
a428fdc951
commit
798f6983e4
1 changed files with 31 additions and 22 deletions
|
@ -1069,14 +1069,20 @@ class TestMain(TestCase):
|
||||||
metadata_file = Path(".aider.model.metadata.json")
|
metadata_file = Path(".aider.model.metadata.json")
|
||||||
test_models = {
|
test_models = {
|
||||||
"test-provider/unique-model-name": {"max_input_tokens": 8192},
|
"test-provider/unique-model-name": {"max_input_tokens": 8192},
|
||||||
"another-provider/another-unique-model": {"max_input_tokens": 4096}
|
"another-provider/another-unique-model": {"max_input_tokens": 4096},
|
||||||
}
|
}
|
||||||
metadata_file.write_text(json.dumps(test_models))
|
metadata_file.write_text(json.dumps(test_models))
|
||||||
|
|
||||||
# Capture stdout to check the output
|
# Capture stdout to check the output
|
||||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||||
main(
|
main(
|
||||||
["--list-models", "unique-model", "--model-metadata-file", str(metadata_file), "--yes"],
|
[
|
||||||
|
"--list-models",
|
||||||
|
"unique-model",
|
||||||
|
"--model-metadata-file",
|
||||||
|
str(metadata_file),
|
||||||
|
"--yes",
|
||||||
|
],
|
||||||
input=DummyInput(),
|
input=DummyInput(),
|
||||||
output=DummyOutput(),
|
output=DummyOutput(),
|
||||||
)
|
)
|
||||||
|
@ -1090,20 +1096,25 @@ class TestMain(TestCase):
|
||||||
with GitTemporaryDirectory():
|
with GitTemporaryDirectory():
|
||||||
# Create a temporary model-metadata.json with test models
|
# Create a temporary model-metadata.json with test models
|
||||||
metadata_file = Path(".aider.model.metadata.json")
|
metadata_file = Path(".aider.model.metadata.json")
|
||||||
test_models = {
|
test_models = {"test-provider/metadata-only-model": {"max_input_tokens": 8192}}
|
||||||
"test-provider/metadata-only-model": {"max_input_tokens": 8192}
|
|
||||||
}
|
|
||||||
metadata_file.write_text(json.dumps(test_models))
|
metadata_file.write_text(json.dumps(test_models))
|
||||||
|
|
||||||
# Patch litellm.model_cost to include a test model
|
# Patch litellm.model_cost to include a test model
|
||||||
litellm_test_model = "litellm-only-model"
|
litellm_test_model = "litellm-only-model"
|
||||||
with patch("aider.models.litellm.model_cost", {
|
with patch(
|
||||||
litellm_test_model: {"mode": "chat", "litellm_provider": "test-provider"}
|
"aider.models.litellm.model_cost",
|
||||||
}):
|
{litellm_test_model: {"mode": "chat", "litellm_provider": "test-provider"}},
|
||||||
|
):
|
||||||
# Capture stdout to check the output
|
# Capture stdout to check the output
|
||||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||||
main(
|
main(
|
||||||
["--list-models", "model", "--model-metadata-file", str(metadata_file), "--yes"],
|
[
|
||||||
|
"--list-models",
|
||||||
|
"model",
|
||||||
|
"--model-metadata-file",
|
||||||
|
str(metadata_file),
|
||||||
|
"--yes",
|
||||||
|
],
|
||||||
input=DummyInput(),
|
input=DummyInput(),
|
||||||
output=DummyOutput(),
|
output=DummyOutput(),
|
||||||
)
|
)
|
||||||
|
@ -1138,9 +1149,7 @@ class TestMain(TestCase):
|
||||||
# Test that models from resources/model-metadata.json are included in list-models output
|
# Test that models from resources/model-metadata.json are included in list-models output
|
||||||
with GitTemporaryDirectory():
|
with GitTemporaryDirectory():
|
||||||
# Mock the importlib.resources.open_text to return a custom model-metadata.json
|
# Mock the importlib.resources.open_text to return a custom model-metadata.json
|
||||||
test_resource_models = {
|
test_resource_models = {"resource-provider/special-model": {"max_input_tokens": 8192}}
|
||||||
"resource-provider/special-model": {"max_input_tokens": 8192}
|
|
||||||
}
|
|
||||||
|
|
||||||
mock_file = MagicMock()
|
mock_file = MagicMock()
|
||||||
mock_file.read.return_value = json.dumps(test_resource_models)
|
mock_file.read.return_value = json.dumps(test_resource_models)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue