mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
refactor: Use temporary YAML file for model settings in test_default_and_override_settings
This commit is contained in:
parent
6133fa8384
commit
7b9a76c5ea
1 changed files with 36 additions and 28 deletions
|
@ -91,20 +91,28 @@ class TestModels(unittest.TestCase):
|
||||||
) # Check that one of the warnings mentions the bogus model
|
) # Check that one of the warnings mentions the bogus model
|
||||||
|
|
||||||
def test_default_and_override_settings(self):
|
def test_default_and_override_settings(self):
|
||||||
# Add default and override settings to MODEL_SETTINGS
|
import tempfile
|
||||||
MODEL_SETTINGS.extend(
|
import yaml
|
||||||
[
|
|
||||||
ModelSettings(
|
# Create temporary YAML file with test settings
|
||||||
name="aider/default",
|
test_settings = [
|
||||||
edit_format="fake",
|
{
|
||||||
use_repo_map=True,
|
"name": "aider/default",
|
||||||
),
|
"edit_format": "fake",
|
||||||
ModelSettings(
|
"use_repo_map": True,
|
||||||
name="aider/override",
|
},
|
||||||
use_temperature=False,
|
{
|
||||||
),
|
"name": "aider/override",
|
||||||
|
"use_temperature": False,
|
||||||
|
}
|
||||||
]
|
]
|
||||||
)
|
|
||||||
|
with tempfile.NamedTemporaryFile(mode='w', suffix='.yml') as tmp:
|
||||||
|
yaml.dump(test_settings, tmp)
|
||||||
|
tmp.flush()
|
||||||
|
|
||||||
|
# Register the test settings
|
||||||
|
register_models([tmp.name])
|
||||||
|
|
||||||
# Test that defaults are applied when no exact match
|
# Test that defaults are applied when no exact match
|
||||||
model = Model("unknown-model")
|
model = Model("unknown-model")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue