From 7d0411ab6136c1b78f23651f9cccbd88fc05d39e Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 21 Jun 2026 16:07:06 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20tests=20for=20separate=20i?= =?UTF-8?q?n=20bandscope=5Fanalysis=20separator.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/analysis-engine/tests/test_separation.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/analysis-engine/tests/test_separation.py b/services/analysis-engine/tests/test_separation.py index 33dceff6..81e27cc1 100644 --- a/services/analysis-engine/tests/test_separation.py +++ b/services/analysis-engine/tests/test_separation.py @@ -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 @@ -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