test: cover audio, sequences, pattern direction, and settings

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-17 18:32:12 +12:00
parent c286e504eb
commit 301e1c64bf
11 changed files with 681 additions and 20 deletions

View File

@@ -0,0 +1,28 @@
"""Beat interval plausibility helpers (audio detector)."""
import os
import sys
from collections import deque
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
from tests.beat_detect import _is_plausible_ioi, _resolve_bpm # noqa: E402
def test_is_plausible_ioi_rejects_double_time():
times = deque([0.0, 0.5, 1.0])
assert _is_plausible_ioi(1.0, times, 1.15) is False
def test_is_plausible_ioi_accepts_steady_grid():
times = deque([0.0, 0.5, 1.0])
assert _is_plausible_ioi(1.0, times, 1.5) is True
def test_resolve_bpm_prefers_intervals_over_wrong_aubio():
times = deque([0.0, 0.5, 1.0, 1.5, 2.0])
bpm = _resolve_bpm(times, 70.0)
assert bpm is not None
assert abs(bpm - 120.0) < 5.0