From 13909a676ab0a7d98e0fe7027f066b4cae84ac00 Mon Sep 17 00:00:00 2001 From: Maximos Kaliakatsos-Papakostas Date: Thu, 23 Jan 2025 18:36:36 +0200 Subject: [PATCH] Only "proper" chord types in ```mir_eval.chord.QUALITIES``` (#397) * added some chord types in the chord.py regex * moved chords test * all chord types are understood * removed ureachable types * added test and removed notebook * correcting test * Update tests/test_chord.py * Update tests/test_chord.py --------- Co-authored-by: Brian McFee --- mir_eval/chord.py | 4 ---- tests/test_chord.py | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mir_eval/chord.py b/mir_eval/chord.py index d2488d12..a5b2d64d 100644 --- a/mir_eval/chord.py +++ b/mir_eval/chord.py @@ -261,15 +261,11 @@ def scale_degree_to_bitmap(scale_degree, modulo=False, length=BITMAP_LENGTH): "maj9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1], "min9": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], "9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], - "b9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], - "#9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], "min11": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], "11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], - "#11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], "maj13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1], "min13": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], "13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], - "b13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], "1": [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "5": [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], "": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], diff --git a/tests/test_chord.py b/tests/test_chord.py index 35e8b484..e8db17fa 100644 --- a/tests/test_chord.py +++ b/tests/test_chord.py @@ -638,3 +638,11 @@ def test_validate(): # Test that error is thrown on different-length labels with pytest.raises(ValueError): mir_eval.chord.validate([], ["C"]) + + +@pytest.mark.parametrize("quality", list(mir_eval.chord.QUALITIES.keys())) +def test_chord_qualities(quality): + if len(quality) > 0: + mir_eval.chord.encode(f"C:{quality}", reduce_extended_chords=True) + else: + mir_eval.chord.encode("C", reduce_extended_chords=True)