31a8949d64
Files corrected: - src/fuzzy_anchor.py (18 violations) - src/patch_modal.py (14 violations) - scripts/extract_symbols.py (4 violations) - scripts/tasks/download_fonts.py (8 violations) - tests/: 23 files with indentation issues All files verified with py_compile. Remaining 4 files (test_api_events.py, test_discussion_takes_gui.py, test_gui_updates.py, test_headless_service.py) have complex multi-line with statements that require manual correction.
31 lines
924 B
Python
31 lines
924 B
Python
import pytest
|
|
from src.aggregate import group_files_by_dir, compute_file_stats
|
|
from src.models import FileItem
|
|
|
|
def test_group_files_by_dir():
|
|
files = [
|
|
FileItem(path="src/main.py"),
|
|
FileItem(path="src/utils/helpers.py"),
|
|
FileItem(path="tests/test_main.py"),
|
|
FileItem(path="README.md")
|
|
]
|
|
grouped = group_files_by_dir(files)
|
|
assert len(grouped) == 4
|
|
assert grouped["src"] == [files[0]]
|
|
assert grouped["src/utils"] == [files[1]]
|
|
assert grouped["tests"] == [files[2]]
|
|
assert grouped["."] == [files[3]]
|
|
|
|
def test_compute_file_stats():
|
|
import tempfile
|
|
import os
|
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
# Create a dummy python file
|
|
py_path = os.path.join(temp_dir, "test.py")
|
|
with open(py_path, "w") as f:
|
|
f.write("def foo():\n pass\n\nclass Bar:\n pass\n")
|
|
|
|
stats = compute_file_stats(py_path)
|
|
assert stats["lines"] == 5
|
|
assert stats["ast_elements"] == 2 # 1 func, 1 class
|