Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion services/analysis-engine/tests/test_separation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_stem_separator_deduplicates() -> None:
def test_stem_separator_invalid_role() -> None:
"""Test separator handles non-dict roles gracefully."""
separator = StemSeparator()
result = separator.separate(
result = separator.separate( # type: ignore[arg-type]
[{"id": "bass", "name": "Bass", "roleType": "instrument"}, "invalid"]
)
assert len(result["stems"]) == 1
Expand Down Expand Up @@ -135,6 +135,16 @@ def test_stem_separator_keyboard_name_match() -> None:
assert result["stems"][0]["category"] == "keys"


def test_stem_separator_missing_id() -> None:
"""Test separator handles roles with missing id by generating a fallback id."""
separator = StemSeparator()
roles = [{"name": "Lead Vocal", "roleType": "vocal"}]
result = separator.separate(roles)
assert len(result["stems"]) == 1
assert result["stems"][0]["stem_id"] == "stem-role-0"
assert result["stems"][0]["label"] == "Lead Vocal"


def test_audio_stem_separator_splits_local_audio_into_chunked_stems(tmp_path) -> None:
"""Ensure local audio is separated into downstream-consumable canonical stems."""
sample_rate = 8_000
Expand Down