"""Focused hygiene-helper tests for titan-iac quality modules.""" from __future__ import annotations from pathlib import Path from testing.quality_hygiene import count_files_over_line_limit def test_count_files_over_line_limit_counts_only_long_matches(tmp_path: Path) -> None: """Only files beyond the configured limit should contribute to the LOC total.""" tests_dir = tmp_path / "tests" tests_dir.mkdir() (tests_dir / "test_short.py").write_text("line\n", encoding="utf-8") (tests_dir / "test_long.py").write_text("line\n" * 4, encoding="utf-8") (tests_dir / "notes.txt").write_text("line\n" * 8, encoding="utf-8") contract = { "hygiene": { "max_lines": 3, "line_limit_globs": ["tests/*.py"], } } assert count_files_over_line_limit(contract, tmp_path) == 1