The ui_summary_only global aggregation toggle was redundant with per-file flags (auto_aggregate, force_full). Removed: - Checkbox from Projects panel (gui_2.py) - State variable and project load/save (app_controller.py) Per-file flags remain the intended mechanism for controlling aggregation. Tests added to verify removal and per-file flag functionality.
76 lines
2.1 KiB
Python
76 lines
2.1 KiB
Python
import pytest
|
|
import inspect
|
|
from src import models
|
|
|
|
|
|
def test_ui_summary_only_not_in_projects_panel():
|
|
import src.gui_2 as gui_2
|
|
|
|
source = inspect.getsource(gui_2.App._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 = models.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 = models.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 = models.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
|