Spaces:
Sleeping
Sleeping
| """Tests for config/settings.py.""" | |
| from pathlib import Path | |
| class TestSettings: | |
| def test_loads_config_yaml(self): | |
| from config.settings import settings | |
| assert settings.agents | |
| assert "design" in settings.agents | |
| def test_output_dir_property(self): | |
| from config.settings import settings | |
| assert isinstance(settings.output_dir, Path) | |
| def test_web_port_property(self): | |
| from config.settings import settings | |
| assert isinstance(settings.web_port, int) | |
| assert settings.web_port > 0 | |
| def test_model_for_property(self): | |
| from config.settings import settings | |
| models = settings.model_for | |
| assert "anthropic" in models | |
| assert "openai" in models | |
| assert "gemini" in models | |
| def test_max_tokens_property(self): | |
| from config.settings import settings | |
| assert settings.max_tokens == 8192 | |
| def test_temperature_property(self): | |
| from config.settings import settings | |
| assert settings.temperature == 0.2 | |
| def test_validation_config(self): | |
| from config.settings import settings | |
| assert settings.validation.min_wall_thickness_mm == 1.5 | |
| def test_routing_keywords_loaded(self): | |
| from config.settings import settings | |
| assert "design" in settings.routing.keywords | |
| assert "engineering" in settings.routing.keywords | |
| def test_fasteners_loaded(self): | |
| from config.settings import settings | |
| assert settings.fasteners["M6"] == 6.6 # fasteners is a flat dict — bracket access is correct | |
| def test_materials_loaded(self): | |
| from config.settings import settings | |
| assert "aluminum" in settings.materials | |
| class TestPlanningConfig: | |
| def test_planning_defaults(self): | |
| from config.settings import Settings | |
| s = Settings() | |
| assert s.planning.threshold == 8.0 | |
| assert s.planning.weights["material"] == 3 | |
| assert s.planning.caps["dimension"] == 4 | |
| assert "plan" in s.planning.trigger_keywords | |
| assert "cad" in s.planning.approved_agents | |
| def test_planning_threshold_from_yaml(self): | |
| from config.settings import settings | |
| assert settings.planning.threshold == 8.0 | |
| def test_planning_field_agents_defaults(): | |
| from config.settings import PlanningConfig | |
| cfg = PlanningConfig() | |
| assert cfg.field_agents["material"] == "engineering" | |
| assert cfg.field_agents["features"] == "design" | |
| assert cfg.field_agents["constraints"] == "cnc" | |
| assert cfg.field_agents["axis_recommendation"] == "cnc" | |
| assert cfg.field_agents["part_name"] == "design" | |
| class TestGapAnalysisConfig: | |
| def test_gap_analysis_defaults(self): | |
| from config.settings import Settings | |
| s = Settings() | |
| assert s.gap_analysis.model == "gemini/gemini-2.5-flash" | |
| assert s.gap_analysis.temperature == 0.1 | |
| assert s.gap_analysis.max_tokens == 2048 | |
| def test_gap_analysis_loaded_from_yaml(self): | |
| from config.settings import settings | |
| assert settings.gap_analysis.model == "gemini/gemini-2.5-flash" | |
| assert settings.gap_analysis.temperature == 0.1 | |
| assert settings.gap_analysis.max_tokens == 2048 | |
| def test_gap_analysis_config_has_model_field(): | |
| """New GapAnalysisConfig should have model, temperature, max_tokens.""" | |
| from config.settings import GapAnalysisConfig | |
| cfg = GapAnalysisConfig() | |
| assert cfg.model == "gemini/gemini-2.5-flash" | |
| assert cfg.temperature == 0.1 | |
| assert cfg.max_tokens == 2048 | |
| def test_gap_analysis_config_no_keyword_fields(): | |
| """Old category_keywords and category_agents should not exist.""" | |
| from config.settings import GapAnalysisConfig | |
| cfg = GapAnalysisConfig() | |
| assert not hasattr(cfg, "category_keywords") | |
| assert not hasattr(cfg, "category_agents") | |