style: Fix whitespace and formatting in test file

This commit is contained in:
Paul Gauthier (aider) 2025-03-25 13:30:19 -10:00
parent a428fdc951
commit 798f6983e4

View file

@ -1069,14 +1069,20 @@ class TestMain(TestCase):
metadata_file = Path(".aider.model.metadata.json")
test_models = {
"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))
# Capture stdout to check the output
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
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(),
output=DummyOutput(),
)
@ -1090,20 +1096,25 @@ class TestMain(TestCase):
with GitTemporaryDirectory():
# Create a temporary model-metadata.json with test models
metadata_file = Path(".aider.model.metadata.json")
test_models = {
"test-provider/metadata-only-model": {"max_input_tokens": 8192}
}
test_models = {"test-provider/metadata-only-model": {"max_input_tokens": 8192}}
metadata_file.write_text(json.dumps(test_models))
# Patch litellm.model_cost to include a test model
litellm_test_model = "litellm-only-model"
with patch("aider.models.litellm.model_cost", {
litellm_test_model: {"mode": "chat", "litellm_provider": "test-provider"}
}):
with patch(
"aider.models.litellm.model_cost",
{litellm_test_model: {"mode": "chat", "litellm_provider": "test-provider"}},
):
# Capture stdout to check the output
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
main(
["--list-models", "model", "--model-metadata-file", str(metadata_file), "--yes"],
[
"--list-models",
"model",
"--model-metadata-file",
str(metadata_file),
"--yes",
],
input=DummyInput(),
output=DummyOutput(),
)
@ -1138,9 +1149,7 @@ class TestMain(TestCase):
# Test that models from resources/model-metadata.json are included in list-models output
with GitTemporaryDirectory():
# Mock the importlib.resources.open_text to return a custom model-metadata.json
test_resource_models = {
"resource-provider/special-model": {"max_input_tokens": 8192}
}
test_resource_models = {"resource-provider/special-model": {"max_input_tokens": 8192}}
mock_file = MagicMock()
mock_file.read.return_value = json.dumps(test_resource_models)