6a3c142bfa
Removed 18 unused 'from src import models' imports. Migrated the explicit sub-imports: - 'from src.models import PROVIDERS' -> 'from src.ai_client import PROVIDERS' (test_minimax_provider x2, test_deepseek_infra) - 'from src.models import Metadata' -> 'from src.type_aliases import Metadata' (test_project_manager_tracks, test_track_state_persistence, test_track_state_schema) Kept the 2 'import src.models as models' in test_provider_curation + test_providers_source_of_truth (they verify the backward-compat shim still re-exports PROVIDERS) and the 2 self-tests (test_models_no_top_level_pydantic + test_models_no_top_level_tomli_w) that exercise the shim's no-leak invariants.
76 lines
1.9 KiB
Python
76 lines
1.9 KiB
Python
import pytest
|
|
import inspect
|
|
|
|
|
|
from src.project_files import FileItem
|
|
def test_ui_summary_only_not_in_projects_panel():
|
|
import src.gui_2 as gui_2
|
|
|
|
source = inspect.getsource(gui_2.render_projects_panel)
|
|
assert "ui_summary_only" not in source, (
|
|
"ui_summary_only checkbox should be removed from Projects panel"
|
|
)
|
|
assert "Summary Only" not in source, (
|
|
"Summary Only label should be removed from Projects panel"
|
|
)
|
|
|
|
|
|
def test_ui_summary_only_not_in_app_controller_projects():
|
|
import src.app_controller as app_controller
|
|
|
|
source = inspect.getsource(app_controller.AppController)
|
|
assert "ui_summary_only" not in source, (
|
|
"ui_summary_only should be removed from AppController"
|
|
)
|
|
|
|
|
|
def test_file_item_has_per_file_flags():
|
|
item = FileItem(path="test.py")
|
|
assert hasattr(item, "auto_aggregate")
|
|
assert hasattr(item, "force_full")
|
|
assert item.auto_aggregate is True
|
|
assert item.force_full is False
|
|
|
|
|
|
def test_file_item_serialization_with_flags():
|
|
item = FileItem(path="test.py", auto_aggregate=False, force_full=True)
|
|
data = item.to_dict()
|
|
|
|
assert data["auto_aggregate"] is False
|
|
assert data["force_full"] is True
|
|
|
|
restored = FileItem.from_dict(data)
|
|
assert restored.auto_aggregate is False
|
|
assert restored.force_full is True
|
|
|
|
|
|
def test_project_without_summary_only_loads():
|
|
proj = {"project": {"name": "test", "paths": []}}
|
|
assert proj.get("project", {}).get("summary_only") is None
|
|
|
|
|
|
def test_aggregate_from_items_respects_auto_aggregate():
|
|
from pathlib import Path
|
|
from src import aggregate
|
|
|
|
items = [
|
|
{
|
|
"path": Path("file1.py"),
|
|
"entry": "file1.py",
|
|
"content": "print('hello')",
|
|
"auto_aggregate": True,
|
|
"force_full": False,
|
|
},
|
|
{
|
|
"path": Path("file2.py"),
|
|
"entry": "file2.py",
|
|
"content": "print('world')",
|
|
"auto_aggregate": False,
|
|
"force_full": False,
|
|
},
|
|
]
|
|
|
|
result = aggregate._build_files_section_from_items(items)
|
|
assert "file1.py" in result
|
|
assert "file2.py" not in result
|