Aller au contenu
login
arrow_backRetour aux issues
HafidIdrissi/Time-Tracker #22

Add report-period clipping tests at date-range boundaries

ecoDébutant enhancement help wanted good first issue

descriptionDescription

## User problem `collect_periods()` clips stored activity to the selected report range and recomputes durations. This is essential for accurate daily totals, but the current report tests construct already-clipped periods and do not exercise this boundary logic. ## Expected result Add focused tests using a temporary `ActivityDatabase` and `Categorizer` to verify clipping at both ends of a range. ## Likely files - `tests/test_reporting.py` - `timetracker/reporting.py` only if a test reveals a defect ## Acceptance criteria - Cover a period that begins before the selected range. - Cover a period that ends after the selected range. - Cover a period spanning the entire range. - Verify recalculated start, end, and `duration_seconds` values. - Verify that zero-length results are omitted. - Verify active category assignment and the fixed Idle label/category behavior. - Use timezone-aware datetimes and avoid assumptions that every local day is exactly 24 hours. ## Test command ```powershell python -m unittest tests.test_reporting -v python -m unittest discover -v ```
codeOuvre sur GitHub