35ac92e938
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
970 B
Python
29 lines
970 B
Python
"""Unit tests for analysis.data_audit."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from cerbero_bite.analysis.data_audit import _expected_ticks # noqa: PLC2701
|
|
|
|
|
|
def test_expected_ticks_basic() -> None:
|
|
since = datetime(2026, 5, 12, 12, 0, tzinfo=UTC)
|
|
until = datetime(2026, 5, 12, 13, 0, tzinfo=UTC)
|
|
# 12:00, 12:15, 12:30, 12:45 → 4 ticks before 13:00
|
|
assert _expected_ticks(since, until) == 4
|
|
|
|
|
|
def test_expected_ticks_inclusive_left_exclusive_right() -> None:
|
|
since = datetime(2026, 5, 12, 12, 0, tzinfo=UTC)
|
|
until = datetime(2026, 5, 12, 12, 15, tzinfo=UTC)
|
|
# Only 12:00
|
|
assert _expected_ticks(since, until) == 1
|
|
|
|
|
|
def test_expected_ticks_unaligned_since_rounds_up() -> None:
|
|
since = datetime(2026, 5, 12, 12, 7, tzinfo=UTC)
|
|
until = datetime(2026, 5, 12, 12, 30, tzinfo=UTC)
|
|
# First aligned tick after 12:07 is 12:15, then 12:30 is excluded
|
|
assert _expected_ticks(since, until) == 1
|