mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 08:18:36 +00:00
Removed config tests that were using private methods
This commit is contained in:
1 parent
f7ab5b2c85
commit
648d020ea8
1 file changed
-61
@@ -124,64 +124,3 @@ class TestProjectConfig:
|
||||
def test_template_is_complete(self):
|
||||
_, is_complete = ProjectConfig._load_yaml(PROJECT_TEMPLATE_FILE)
|
||||
assert is_complete, "Project template YAML is incomplete; all fields must be present (with descriptions)."
|
||||
|
||||
|
||||
class TestProjectConfigHoverBudget:
|
||||
"""Test class for hover_budget validation in ProjectConfig."""
|
||||
|
||||
def _base_project_dict(self, **overrides):
|
||||
data = {
|
||||
"project_name": "test_project",
|
||||
"languages": ["python"],
|
||||
"ignored_paths": [],
|
||||
"excluded_tools": [],
|
||||
"included_optional_tools": [],
|
||||
"read_only": False,
|
||||
"ignore_all_files_in_gitignore": True,
|
||||
"initial_prompt": "",
|
||||
"encoding": "utf-8",
|
||||
"hover_budget": None,
|
||||
}
|
||||
data.update(overrides)
|
||||
return data
|
||||
|
||||
def test_from_dict_accepts_null_budget(self):
|
||||
"""Test that _from_dict accepts null hover budget (for inheritance)."""
|
||||
data = self._base_project_dict()
|
||||
config = ProjectConfig._from_dict(data)
|
||||
assert config.hover_budget is None
|
||||
|
||||
def test_from_dict_accepts_positive_budget(self):
|
||||
"""Test that _from_dict accepts positive hover budget."""
|
||||
data = self._base_project_dict(hover_budget=10.5)
|
||||
config = ProjectConfig._from_dict(data)
|
||||
assert config.hover_budget == 10.5
|
||||
|
||||
def test_from_dict_accepts_zero_budget(self):
|
||||
"""Test that _from_dict accepts zero hover budget (disabled)."""
|
||||
data = self._base_project_dict(hover_budget=0)
|
||||
config = ProjectConfig._from_dict(data)
|
||||
assert config.hover_budget == 0.0
|
||||
|
||||
def test_from_dict_rejects_negative_budget(self):
|
||||
"""Test that _from_dict raises ValueError for negative hover budget."""
|
||||
data = self._base_project_dict(hover_budget=-1.0)
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
ProjectConfig._from_dict(data)
|
||||
assert "cannot be negative" in str(exc_info.value)
|
||||
|
||||
def test_apply_defaults_preserves_null(self):
|
||||
"""Test that _apply_defaults_to_dict preserves None for hover budget."""
|
||||
data = {"project_name": "test", "languages": ["python"]}
|
||||
result = ProjectConfig._apply_defaults_to_dict(data)
|
||||
assert result["hover_budget"] is None
|
||||
|
||||
def test_apply_defaults_preserves_explicit_value(self):
|
||||
"""Test that _apply_defaults_to_dict preserves explicit hover budget value."""
|
||||
data = {
|
||||
"project_name": "test",
|
||||
"languages": ["python"],
|
||||
"hover_budget": 15.0,
|
||||
}
|
||||
result = ProjectConfig._apply_defaults_to_dict(data)
|
||||
assert result["hover_budget"] == 15.0
|
||||
Reference in new issue
Block a user