From 6d4ea39fa615e0c6948ace60c5a85f775d774a2b Mon Sep 17 00:00:00 2001 From: Harsh Palan Date: Tue, 22 Nov 2022 14:47:52 -0500 Subject: [PATCH 1/5] updating file paths and issues with windows --- tests/test_core.py | 26 +++++++++++++------------- tests/test_io.py | 4 ++-- tests/test_loaders.py | 2 +- tests/test_utils.py | 9 +++++---- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index b1534f7a3..77794d739 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -36,7 +36,7 @@ def test_track(): track.to_jams() path_good = track.get_path("annotation") - assert path_good == "tests/resources/mir_datasets/asdf/asdd" + assert os.path.normpath(path_good) == os.path.normpath("tests/resources/mir_datasets/asdf/asdd") path_none = track.get_path("audio") assert path_none is None @@ -191,23 +191,23 @@ def __init__(self, data_home=None, version="default"): dataset = VersionTest("asdf") assert dataset.version == "1" - assert dataset.index_path == "asdf/mirdata_indexes/blah_1.json" + assert os.path.normpath(dataset.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") dataset_default = VersionTest("asdf", version="default") assert dataset_default.version == "1" - assert dataset_default.index_path == "asdf/mirdata_indexes/blah_1.json" + assert os.path.normpath(dataset_default.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") dataset_1 = VersionTest("asdf", version="1") assert dataset_1.version == "1" - assert dataset_1.index_path == "asdf/mirdata_indexes/blah_1.json" + assert os.path.normpath(dataset_1.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") with pytest.raises(FileNotFoundError): dataset_1._index local_index_path = os.path.dirname(os.path.realpath(__file__))[:-5] dataset_test = VersionTest("asdf", version="test") assert dataset_test.version == "0" - assert dataset_test.index_path == os.path.join( - local_index_path, "mirdata/datasets/indexes/blah_0.json" + assert os.path.normpath(dataset_test.index_path) == os.path.join( + local_index_path, os.path.normpath("mirdata/datasets/indexes/blah_0.json") ) with pytest.raises(IOError): @@ -215,20 +215,20 @@ def __init__(self, data_home=None, version="default"): dataset_0 = VersionTest("asdf", version="0") assert dataset_0.version == "0" - assert dataset_0.index_path == os.path.join( - local_index_path, "mirdata/datasets/indexes/blah_0.json" + assert os.path.normpath(dataset_0.index_path) == os.path.join( + local_index_path, os.path.normpath("mirdata/datasets/indexes/blah_0.json") ) dataset_2 = VersionTest("asdf", version="2") assert dataset_2.version == "2" - assert dataset_2.index_path == os.path.join( - local_index_path, "mirdata/datasets/indexes/blah_2.json" + assert os.path.normpath(dataset_2.index_path) == os.path.join( + local_index_path, os.path.normpath("mirdata/datasets/indexes/blah_2.json") ) dataset_real = VersionTest("asdf", version="real") assert dataset_real.version == "real" - assert dataset_real.index_path == os.path.join( - local_index_path, "mirdata/datasets/indexes/beatles_index_1.2.json" + assert os.path.normpath(dataset_real.index_path) == os.path.join( + local_index_path, os.path.normpath("mirdata/datasets/indexes/beatles_index_1.2.json") ) idx_test = dataset_real._index assert isinstance(idx_test, dict) @@ -303,7 +303,7 @@ def test_multitrack(): ) path_good = mtrack.get_path("audio_master") - assert path_good == "tests/resources/mir_datasets/foo/bar" + assert os.path.normpath(path_good) == os.path.normpath("tests/resources/mir_datasets/foo/bar") path_none = mtrack.get_path("score") assert path_none is None diff --git a/tests/test_io.py b/tests/test_io.py index 533b81f66..f9826f5db 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -68,7 +68,7 @@ def func(fh): def test_coerce_to_string_io_with_path(): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(delete=False) as f: @io.coerce_to_string_io def func(fh): @@ -104,7 +104,7 @@ def func(fh): def test_coerce_to_bytes_io_with_path(): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(delete=False) as f: @io.coerce_to_bytes_io def func(fh): diff --git a/tests/test_loaders.py b/tests/test_loaders.py index 36d0e35d3..ce4abada6 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -255,7 +255,7 @@ def test_track(): for dataset_name in DATASETS: dataset = mirdata.initialize( - dataset_name, os.path.join(TEST_DATA_HOME, dataset_name), version="test" + dataset_name, os.path.normpath(os.path.join(TEST_DATA_HOME, dataset_name)), version="test" ) # if the dataset doesn't have a track object, make sure it raises a value error diff --git a/tests/test_utils.py b/tests/test_utils.py index c8c650f91..4a25c4f77 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -9,7 +9,7 @@ import pytest -DEFAULT_DATA_HOME = os.path.join(os.getenv("HOME", "/tmp"), "mir_datasets") +DEFAULT_DATA_HOME = os.path.normpath(os.path.join(os.getenv("HOME", "/tmp"), "mir_datasets")) def run_track_tests(track, expected_attributes, expected_property_types): @@ -115,13 +115,14 @@ def test_md5(mocker): ), ], ) +# mirdata\tests\indexes\test_index_valid.json def test_validate_index(test_index, expected_missing, expected_inv_checksum): - index_path = os.path.join("tests/indexes", test_index) - with open(index_path) as index_file: + index_path = os.path.normpath(os.path.join("tests/indexes", test_index)) + with open(index_path,'r') as index_file: test_index = json.load(index_file) missing_files, invalid_checksums = validate.validate_index( - test_index, "tests/resources/" + test_index, os.path.normpath("tests/resources/") ) assert expected_missing == missing_files From 8b6f62ef4bce4c66672b6831482fea225b05498c Mon Sep 17 00:00:00 2001 From: Harsh Palan Date: Tue, 22 Nov 2022 14:53:06 -0500 Subject: [PATCH 2/5] updating datasets testcases with issues for Windows --- tests/datasets/test_acousticbrainz_genre.py | 16 ++-- tests/datasets/test_beatles.py | 33 +++---- tests/datasets/test_beatport_key.py | 9 +- tests/datasets/test_cante100.py | 14 ++- tests/datasets/test_da_tacos.py | 17 ++-- tests/datasets/test_dagstuhl_choirset.py | 37 ++++---- tests/datasets/test_dali.py | 23 +++-- tests/datasets/test_filosax.py | 13 +-- tests/datasets/test_four_way_tabla.py | 13 +-- tests/datasets/test_freesound_one_shot.py | 11 +-- tests/datasets/test_giantsteps_key.py | 12 ++- tests/datasets/test_giantsteps_tempo.py | 13 +-- tests/datasets/test_good_sounds.py | 13 +-- tests/datasets/test_gtzan_genre.py | 15 ++-- tests/datasets/test_guitarset.py | 23 ++--- tests/datasets/test_haydn_op20.py | 22 +++-- tests/datasets/test_ikala.py | 13 +-- tests/datasets/test_irmas.py | 18 ++-- tests/datasets/test_jingju_acappella.py | 28 +++--- tests/datasets/test_medley_solos_db.py | 7 +- tests/datasets/test_medleydb_melody.py | 19 ++-- tests/datasets/test_medleydb_pitch.py | 16 ++-- tests/datasets/test_mridangam_stroke.py | 6 +- .../test_mtg_jamendo_autotagging_moodtheme.py | 5 +- tests/datasets/test_openmic2018.py | 6 +- tests/datasets/test_orchset.py | 14 +-- tests/datasets/test_otmm_makam.py | 13 +-- tests/datasets/test_phenicx_anechoic.py | 26 +++--- tests/datasets/test_queen.py | 17 ++-- tests/datasets/test_rwc_classical.py | 15 ++-- tests/datasets/test_rwc_jazz.py | 17 ++-- tests/datasets/test_rwc_popular.py | 23 ++--- tests/datasets/test_salami.py | 21 ++--- tests/datasets/test_saraga_carnatic.py | 87 ++++++++++--------- tests/datasets/test_saraga_hindustani.py | 35 ++++---- tests/datasets/test_slakh.py | 25 +++--- tests/datasets/test_tinysol.py | 7 +- tests/datasets/test_tonality_classicaldb.py | 13 +-- tests/datasets/test_tonas.py | 9 +- tests/datasets/test_vocadito.py | 13 +-- 40 files changed, 389 insertions(+), 348 deletions(-) diff --git a/tests/datasets/test_acousticbrainz_genre.py b/tests/datasets/test_acousticbrainz_genre.py index dc81f90b4..a508598ef 100644 --- a/tests/datasets/test_acousticbrainz_genre.py +++ b/tests/datasets/test_acousticbrainz_genre.py @@ -8,13 +8,13 @@ def test_track(): default_trackid = "tagtraum#validation#be9e01e5-8f93-494d-bbaa-ddcc5a52f629#2b6bfcfd-46a5-3f98-a58f-2c51d7c9e960#trance########" - data_home = "tests/resources/mir_datasets/acousticbrainz_genre" + data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre") dataset = acousticbrainz_genre.Dataset(data_home, version="test") track = dataset.track(default_trackid) expected_attributes = { - "path": "tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json", + "path": os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json"), "track_id": "tagtraum#validation#be9e01e5-8f93-494d-bbaa-ddcc5a52f629#2b6bfcfd-46a5-3f98-a58f-2c51d7c9e960#trance########", "genre": ["trance"], "mbid": "be9e01e5-8f93-494d-bbaa-ddcc5a52f629", @@ -39,14 +39,14 @@ def test_track(): def test_load_extractor(): - path = "tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json" + path = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json") extractor_data = acousticbrainz_genre.load_extractor(path) assert isinstance(extractor_data, dict) def test_to_jams(): - data_home = "tests/resources/mir_datasets/acousticbrainz_genre" + data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre") trackid = "tagtraum#validation#be9e01e5-8f93-494d-bbaa-ddcc5a52f629#2b6bfcfd-46a5-3f98-a58f-2c51d7c9e960#trance########" dataset = acousticbrainz_genre.Dataset(data_home, version="test") @@ -57,7 +57,7 @@ def test_to_jams(): def test_filter_index(): - data_home = "tests/resources/mir_datasets/acousticbrainz_genre" + data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre") dataset = acousticbrainz_genre.Dataset(data_home, version="test") index = dataset.load_all_train() assert len(index) == 8 @@ -81,14 +81,14 @@ def test_filter_index(): def test_download(httpserver): - data_home = "tests/resources/mir_datasets/acousticbrainz_genre_download" + data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre_download") if os.path.exists(data_home): shutil.rmtree(data_home) httpserver.serve_content( open( - "tests/resources/download/acousticbrainz_genre_index.json.zip", + os.path.normpath("tests/resources/download/acousticbrainz_genre_index.json.zip"), "rb", ).read() ) @@ -112,7 +112,7 @@ def test_download(httpserver): httpserver.serve_content( open( - "tests/resources/download/acousticbrainz-mediaeval-features-train-01.tar.bz2", + os.path.normpath("tests/resources/download/acousticbrainz-mediaeval-features-train-01.tar.bz2"), "rb", ).read() ) diff --git a/tests/datasets/test_beatles.py b/tests/datasets/test_beatles.py index 4ca083047..0b6f55602 100644 --- a/tests/datasets/test_beatles.py +++ b/tests/datasets/test_beatles.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import beatles @@ -7,21 +8,21 @@ def test_track(): default_trackid = "0111" - data_home = "tests/resources/mir_datasets/beatles" + data_home = os.path.normpath("tests/resources/mir_datasets/beatles") dataset = beatles.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/beatles/" - + "audio/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.wav", - "beats_path": "tests/resources/mir_datasets/beatles/" - + "annotations/beat/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.txt", - "chords_path": "tests/resources/mir_datasets/beatles/" - + "annotations/chordlab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", - "keys_path": "tests/resources/mir_datasets/beatles/" - + "annotations/keylab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", - "sections_path": "tests/resources/mir_datasets/beatles/" - + "annotations/seglab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") + , "audio/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.wav"), + "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") + , "annotations/beat/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.txt"), + "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") + , "annotations/chordlab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), + "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") + , "annotations/keylab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") + , "annotations/seglab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), "title": "11_-_Do_You_Want_To_Know_A_Secret", "track_id": "0111", } @@ -51,7 +52,7 @@ def test_track(): def test_to_jams(): - data_home = "tests/resources/mir_datasets/beatles" + data_home = os.path.normpath("tests/resources/mir_datasets/beatles") dataset = beatles.Dataset(data_home) track = dataset.track("0111") jam = track.to_jams() @@ -153,7 +154,7 @@ def test_to_jams(): def test_load_beats(): - beats_path = ( + beats_path = os.path.normpath( "tests/resources/mir_datasets/beatles/annotations/beat/" + "The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.txt" ) @@ -179,7 +180,7 @@ def test_load_beats(): def test_load_chords(): - chords_path = ( + chords_path = os.path.normpath( "tests/resources/mir_datasets/beatles/annotations/chordlab/" + "The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab" ) @@ -201,7 +202,7 @@ def test_load_chords(): def test_load_key(): - key_path = ( + key_path = os.path.normpath( "tests/resources/mir_datasets/beatles/annotations/keylab/" + "The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab" ) @@ -218,7 +219,7 @@ def test_load_key(): def test_load_sections(): - sections_path = ( + sections_path = os.path.normpath( "tests/resources/mir_datasets/beatles/annotations/seglab/" + "The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab" ) diff --git a/tests/datasets/test_beatport_key.py b/tests/datasets/test_beatport_key.py index b5a29c13c..d3c01a75c 100644 --- a/tests/datasets/test_beatport_key.py +++ b/tests/datasets/test_beatport_key.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import beatport_key @@ -6,14 +7,14 @@ def test_track(): default_trackid = "1" - data_home = "tests/resources/mir_datasets/beatport_key" + data_home = os.path.normpath("tests/resources/mir_datasets/beatport_key") dataset = beatport_key.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/beatport_key/audio/100066 Lindstrom - Monsteer (Original Mix).mp3", - "keys_path": "tests/resources/mir_datasets/beatport_key/keys/100066 Lindstrom - Monsteer (Original Mix).txt", - "metadata_path": "tests/resources/mir_datasets/beatport_key/meta/100066 Lindstrom - Monsteer (Original Mix).json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"audio/100066 Lindstrom - Monsteer (Original Mix).mp3"), + "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"keys/100066 Lindstrom - Monsteer (Original Mix).txt"), + "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"meta/100066 Lindstrom - Monsteer (Original Mix).json"), "title": "100066 Lindstrom - Monsteer (Original Mix)", "track_id": "1", } diff --git a/tests/datasets/test_cante100.py b/tests/datasets/test_cante100.py index 866cf7c4b..bd9df8478 100644 --- a/tests/datasets/test_cante100.py +++ b/tests/datasets/test_cante100.py @@ -7,7 +7,7 @@ from mirdata.datasets import cante100 from tests.test_utils import DEFAULT_DATA_HOME -TEST_DATA_HOME = "tests/resources/mir_datasets/cante100" +TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/cante100") def test_track(): @@ -18,16 +18,12 @@ def test_track(): expected_attributes = { "artist": "Toronjo", "duration": 179.0, - "audio_path": "tests/resources/mir_datasets/cante100/cante100audio/008_PacoToronjo_" - + "Fandangos.mp3", - "f0_path": "tests/resources/mir_datasets/cante100/cante100midi_f0/008_PacoToronjo_" - + "Fandangos.f0.csv", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"), "cante100audio/008_PacoToronjo_Fandangos.mp3"), + "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100midi_f0/008_PacoToronjo_Fandangos.f0.csv"), "identifier": "4eebe839-82bb-426e-914d-7c4525dd9dad", - "notes_path": "tests/resources/mir_datasets/cante100/cante100_automaticTranscription/008_PacoToronjo_" - + "Fandangos.notes.csv", + "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100_automaticTranscription/008_PacoToronjo_Fandangos.notes.csv"), "release": "Atlas del cante flamenco", - "spectrogram_path": "tests/resources/mir_datasets/cante100/cante100_spectrum/008_PacoToronjo_" - + "Fandangos.spectrum.csv", + "spectrogram_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100_spectrum/008_PacoToronjo_Fandangos.spectrum.csv"), "title": "Huelva Como Capital", "track_id": "008", } diff --git a/tests/datasets/test_da_tacos.py b/tests/datasets/test_da_tacos.py index d3be0b0dd..ac110dff8 100644 --- a/tests/datasets/test_da_tacos.py +++ b/tests/datasets/test_da_tacos.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import os import pytest import numpy as np @@ -8,18 +9,18 @@ def test_track(): default_trackid = "coveranalysis#W_163992#P_547131" - data_home = "tests/resources/mir_datasets/da_tacos" + data_home = os.path.normpath("tests/resources/mir_datasets/da_tacos") dataset = da_tacos.Dataset(data_home, version="test") track = dataset.track(default_trackid) expected_attributes = { - "cens_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_cens/W_163992_cens/P_547131_cens.h5", - "crema_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_crema/W_163992_crema/P_547131_crema.h5", - "hpcp_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_hpcp/W_163992_hpcp/P_547131_hpcp.h5", - "key_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_key/W_163992_key/P_547131_key.h5", - "madmom_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_madmom/W_163992_madmom/P_547131_madmom.h5", - "mfcc_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_mfcc/W_163992_mfcc/P_547131_mfcc.h5", - "tags_path": "tests/resources/mir_datasets/da_tacos/da-tacos_coveranalysis_subset_tags/W_163992_tags/P_547131_tags.h5", + "cens_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_cens/W_163992_cens/P_547131_cens.h5"), + "crema_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_crema/W_163992_crema/P_547131_crema.h5"), + "hpcp_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_hpcp/W_163992_hpcp/P_547131_hpcp.h5"), + "key_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_key/W_163992_key/P_547131_key.h5"), + "madmom_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_madmom/W_163992_madmom/P_547131_madmom.h5"), + "mfcc_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_mfcc/W_163992_mfcc/P_547131_mfcc.h5"), + "tags_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_tags/W_163992_tags/P_547131_tags.h5"), "track_id": "coveranalysis#W_163992#P_547131", "performance_id": "P_547131", "subset": "coveranalysis", diff --git a/tests/datasets/test_dagstuhl_choirset.py b/tests/datasets/test_dagstuhl_choirset.py index f14650df3..9d57ff358 100644 --- a/tests/datasets/test_dagstuhl_choirset.py +++ b/tests/datasets/test_dagstuhl_choirset.py @@ -1,3 +1,4 @@ +import os import numpy as np import pytest @@ -8,23 +9,23 @@ def test_track(): default_trackid = "DCS_LI_QuartetB_Take04_B2" - data_home = "tests/resources/mir_datasets/dagstuhl_choirset" + data_home = os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset") dataset = dagstuhl_choirset.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "DCS_LI_QuartetB_Take04_B2", - "audio_dyn_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_DYN.wav", - "audio_hsm_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_HSM.wav", - "audio_lrx_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_LRX.wav", - "f0_crepe_dyn_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_DYN.csv", - "f0_crepe_hsm_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_HSM.csv", - "f0_crepe_lrx_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_LRX.csv", - "f0_pyin_dyn_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_DYN.csv", - "f0_pyin_hsm_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_HSM.csv", - "f0_pyin_lrx_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_LRX.csv", - "f0_manual_lrx_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_F0_manual/DCS_LI_QuartetB_Take04_B2_LRX.csv", - "score_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_scorerepresentation/DCS_LI_QuartetB_Take04_Stereo_STM_B.csv", + "audio_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_DYN.wav"), + "audio_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_HSM.wav"), + "audio_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_LRX.wav"), + "f0_crepe_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_DYN.csv"), + "f0_crepe_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_HSM.csv"), + "f0_crepe_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_LRX.csv"), + "f0_pyin_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_DYN.csv"), + "f0_pyin_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_HSM.csv"), + "f0_pyin_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_LRX.csv"), + "f0_manual_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_manual/DCS_LI_QuartetB_Take04_B2_LRX.csv"), + "score_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_scorerepresentation/DCS_LI_QuartetB_Take04_Stereo_STM_B.csv"), } expected_property_types = { @@ -221,19 +222,19 @@ def test_to_jams_track(): def test_multitrack(): default_trackid = "DCS_LI_QuartetB_Take04" - data_home = "tests/resources/mir_datasets/dagstuhl_choirset" + data_home = os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset") dataset = dagstuhl_choirset.Dataset(data_home) mtrack = dataset.multitrack(default_trackid) expected_attributes = { "mtrack_id": "DCS_LI_QuartetB_Take04", - "audio_stm_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STM.wav", - "audio_str_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STR.wav", - "audio_stl_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STL.wav", - "audio_rev_path": "tests/resources/mir_datasets/dagstuhl_choirset/audio_wav_22050_mono/DCS_LI_QuartetB_Take04_StereoReverb_STM.wav", + "audio_stm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STM.wav"), + "audio_str_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STR.wav"), + "audio_stl_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STL.wav"), + "audio_rev_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_StereoReverb_STM.wav"), "audio_spl_path": None, "audio_spr_path": None, - "beat_path": "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_beat/DCS_LI_QuartetB_Take04_Stereo_STM.csv", + "beat_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_beat/DCS_LI_QuartetB_Take04_Stereo_STM.csv"), "track_ids": [ "DCS_LI_QuartetB_Take04_A2", "DCS_LI_QuartetB_Take04_B2", diff --git a/tests/datasets/test_dali.py b/tests/datasets/test_dali.py index 7ff2604d9..4fcf363ba 100644 --- a/tests/datasets/test_dali.py +++ b/tests/datasets/test_dali.py @@ -1,25 +1,34 @@ -import DALI +import logging +import os + +try: + import DALI +except ImportError: + logging.error( + "In order to use dali you must have dali-dataset installed. " + "Please reinstall mirdata using `pip install 'mirdata[dali]' and re-run the tests" + ) + raise ImportError from mirdata.datasets import dali from mirdata import annotations from tests.test_utils import run_track_tests import numpy as np - def test_track(): default_trackid = "4b196e6c99574dd49ad00d56e132712b" - data_home = "tests/resources/mir_datasets/dali" + data_home = os.path.normpath("tests/resources/mir_datasets/dali") dataset = dali.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "album": "Mezmerize", - "annotation_path": "tests/resources/mir_datasets/dali/" - + "annotations/4b196e6c99574dd49ad00d56e132712b.gz", + "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dali/") + , "annotations/4b196e6c99574dd49ad00d56e132712b.gz"), "artist": "System Of A Down", - "audio_path": "tests/resources/mir_datasets/dali/" - + "audio/4b196e6c99574dd49ad00d56e132712b.mp3", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dali/") + , "audio/4b196e6c99574dd49ad00d56e132712b.mp3"), "audio_url": "zUzd9KyIDrM", "dataset_version": 1, "genres": ["Pop", "Rock", "Hard Rock", "Metal"], diff --git a/tests/datasets/test_filosax.py b/tests/datasets/test_filosax.py index 976ec5d20..dd532c568 100644 --- a/tests/datasets/test_filosax.py +++ b/tests/datasets/test_filosax.py @@ -1,6 +1,7 @@ """ Tests for Filosax_Lite """ +import os import numpy as np import pytest import jams @@ -12,18 +13,18 @@ def test_track(): default_trackid = "multitrack_02_sax_1" - data_home = "tests/resources/mir_datasets/filosax" + data_home = os.path.normpath("tests/resources/mir_datasets/filosax") dataset = filosax.Dataset(data_home, version="test") filosax_data = dataset.load_tracks() default_track = filosax_data[default_trackid] expected_attributes = { "track_id": "multitrack_02_sax_1", - "audio_path": "tests/resources/mir_datasets/filosax/Participant 1/02/Sax.wav", - "annotation_path": "tests/resources/mir_datasets/filosax/Participant 1/02/annotations.json", - "midi_path": "tests/resources/mir_datasets/filosax/Participant 1/02/Sax.mid", - "musicXML_path": "tests/resources/mir_datasets/filosax/Participant 1/02/Sax.musicxml", - "pdf_path": "tests/resources/mir_datasets/filosax/Participant 1/02/Sax.pdf", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.wav"), + "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/annotations.json"), + "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.mid"), + "musicXML_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.musicxml"), + "pdf_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.pdf"), } expected_property_types = { diff --git a/tests/datasets/test_four_way_tabla.py b/tests/datasets/test_four_way_tabla.py index a2b9f33dd..2560d7040 100644 --- a/tests/datasets/test_four_way_tabla.py +++ b/tests/datasets/test_four_way_tabla.py @@ -1,3 +1,4 @@ +import os import numpy as np from tests.test_utils import run_track_tests @@ -8,15 +9,15 @@ def test_track(): default_trackid = "AHK_solo-tintal-1" - data_home = "tests/resources/mir_datasets/four_way_tabla" + data_home = os.path.normpath("tests/resources/mir_datasets/four_way_tabla") dataset = four_way_tabla.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/four_way_tabla/4way-tabla-ismir21-dataset/train/audios/AHK_solo-tintal-1.wav", - "onsets_b_path": "tests/resources/mir_datasets/four_way_tabla/4way-tabla-ismir21-dataset/train/onsets/b/AHK_solo-tintal-1.onsets", - "onsets_d_path": "tests/resources/mir_datasets/four_way_tabla/4way-tabla-ismir21-dataset/train/onsets/d/AHK_solo-tintal-1.onsets", - "onsets_rb_path": "tests/resources/mir_datasets/four_way_tabla/4way-tabla-ismir21-dataset/train/onsets/rb/AHK_solo-tintal-1.onsets", - "onsets_rt_path": "tests/resources/mir_datasets/four_way_tabla/4way-tabla-ismir21-dataset/train/onsets/rt/AHK_solo-tintal-1.onsets", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/audios/AHK_solo-tintal-1.wav"), + "onsets_b_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/b/AHK_solo-tintal-1.onsets"), + "onsets_d_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/d/AHK_solo-tintal-1.onsets"), + "onsets_rb_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/rb/AHK_solo-tintal-1.onsets"), + "onsets_rt_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/rt/AHK_solo-tintal-1.onsets"), "track_id": "AHK_solo-tintal-1", "train": True, } diff --git a/tests/datasets/test_freesound_one_shot.py b/tests/datasets/test_freesound_one_shot.py index 3026696d1..6aadaf4a9 100644 --- a/tests/datasets/test_freesound_one_shot.py +++ b/tests/datasets/test_freesound_one_shot.py @@ -1,9 +1,10 @@ +import os import numpy as np from tests.test_utils import run_track_tests from mirdata.datasets import freesound_one_shot_percussive_sounds -TEST_DATA_HOME = "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds" +TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds") def test_track(): @@ -12,10 +13,10 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/" - + "one_shot_percussive_sounds/1/183.wav", - "file_metadata_path": "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/" - + "analysis/1/183_analysis.json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/") + , "one_shot_percussive_sounds/1/183.wav"), + "file_metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/") + , "analysis/1/183_analysis.json"), "track_id": "183", } diff --git a/tests/datasets/test_giantsteps_key.py b/tests/datasets/test_giantsteps_key.py index 94f95a18b..fb521bb22 100644 --- a/tests/datasets/test_giantsteps_key.py +++ b/tests/datasets/test_giantsteps_key.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import giantsteps_key @@ -6,17 +7,14 @@ def test_track(): default_trackid = "3" - data_home = "tests/resources/mir_datasets/giantsteps_key" + data_home = os.path.normpath("tests/resources/mir_datasets/giantsteps_key") dataset = giantsteps_key.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/giantsteps_key/audio/10089 Jason Sparks - Close My Eyes feat. J. " - "Little (Original Mix).mp3", - "keys_path": "tests/resources/mir_datasets/giantsteps_key/keys_gs+/10089 Jason Sparks - Close My Eyes feat. J. " - "Little (Original Mix).txt", - "metadata_path": "tests/resources/mir_datasets/giantsteps_key/meta/10089 Jason Sparks - Close My Eyes feat. J. " - "Little (Original Mix).json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"audio/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).mp3"), + "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"keys_gs+/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).txt"), + "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"meta/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).json"), "title": "10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix)", "track_id": "3", } diff --git a/tests/datasets/test_giantsteps_tempo.py b/tests/datasets/test_giantsteps_tempo.py index c31498038..9840d300e 100644 --- a/tests/datasets/test_giantsteps_tempo.py +++ b/tests/datasets/test_giantsteps_tempo.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import giantsteps_tempo @@ -7,16 +8,16 @@ def test_track(): default_trackid = "113" - data_home = "tests/resources/mir_datasets/giantsteps_tempo" + data_home = os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo") dataset = giantsteps_tempo.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/giantsteps_tempo/audio/28952.LOFI.mp3", - "annotation_v1_path": "tests/resources/mir_datasets/giantsteps_tempo/giantsteps-tempo-dataset" - "-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations/jams/28952.LOFI.jams", - "annotation_v2_path": "tests/resources/mir_datasets/giantsteps_tempo/giantsteps-tempo-dataset" - "-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations_v2/jams/28952.LOFI.jams", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/"),"audio/28952.LOFI.mp3"), + "annotation_v1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/") + ,"giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations/jams/28952.LOFI.jams"), + "annotation_v2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/") + ,"giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations_v2/jams/28952.LOFI.jams"), "title": "28952", "track_id": "113", } diff --git a/tests/datasets/test_good_sounds.py b/tests/datasets/test_good_sounds.py index 3178de017..9898b2b4c 100644 --- a/tests/datasets/test_good_sounds.py +++ b/tests/datasets/test_good_sounds.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import good_sounds @@ -6,12 +7,12 @@ def test_track(): default_trackid = "1" - data_home = "tests/resources/mir_datasets/good_sounds" + data_home = os.path.normpath("tests/resources/mir_datasets/good_sounds") dataset = good_sounds.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/good_sounds/good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), "track_id": "1", } @@ -39,7 +40,7 @@ def test_track(): def test_track_properties_and_attributes(): default_trackid = "1" - data_home = "tests/resources/mir_datasets/good_sounds" + data_home = os.path.normpath("tests/resources/mir_datasets/good_sounds") dataset = good_sounds.Dataset(data_home) track = dataset.track(default_trackid) ground_truth_sound = { @@ -72,7 +73,7 @@ def test_track_properties_and_attributes(): ground_truth_take = { "id": 1, "microphone": "akg", - "filename": "tests/resources/mir_datasets/good_sounds/good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + "filename": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), "original_filename": "AKG-costado-Left-01 render 001", "freesound_id": None, "sound_id": 1, @@ -97,7 +98,7 @@ def test_track_properties_and_attributes(): def test_to_jams(): default_trackid = "1" - data_home = "tests/resources/mir_datasets/good_sounds" + data_home = os.path.normpath("tests/resources/mir_datasets/good_sounds") dataset = good_sounds.Dataset(data_home) track = dataset.track(default_trackid) @@ -132,7 +133,7 @@ def test_to_jams(): ground_truth_take = { "id": 1, "microphone": "akg", - "filename": "tests/resources/mir_datasets/good_sounds/good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + "filename": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), "original_filename": "AKG-costado-Left-01 render 001", "freesound_id": None, "sound_id": 1, diff --git a/tests/datasets/test_gtzan_genre.py b/tests/datasets/test_gtzan_genre.py index 4e12976c5..1b4343d22 100644 --- a/tests/datasets/test_gtzan_genre.py +++ b/tests/datasets/test_gtzan_genre.py @@ -1,9 +1,10 @@ +import os import numpy as np from tests.test_utils import run_track_tests from mirdata import annotations from mirdata.datasets import gtzan_genre -TEST_DATA_HOME = "tests/resources/mir_datasets/gtzan_genre" +TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/gtzan_genre") def test_track(): @@ -12,12 +13,12 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { "genre": "country", - "audio_path": "tests/resources/mir_datasets/gtzan_genre/" - + "gtzan_genre/genres/country/country.00000.wav", - "beats_path": "tests/resources/mir_datasets/gtzan_genre/" - + "gtzan_tempo_beat-main/beats/gtzan_country_00000.beats", - "tempo_path": "tests/resources/mir_datasets/gtzan_genre/" - + "gtzan_tempo_beat-main/tempo/gtzan_country_00000.bpm", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") + , "gtzan_genre/genres/country/country.00000.wav"), + "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") + , "gtzan_tempo_beat-main/beats/gtzan_country_00000.beats"), + "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") + , "gtzan_tempo_beat-main/tempo/gtzan_country_00000.bpm"), "track_id": "country.00000", } expected_properties = { diff --git a/tests/datasets/test_guitarset.py b/tests/datasets/test_guitarset.py index 269d903d8..c38345f3a 100644 --- a/tests/datasets/test_guitarset.py +++ b/tests/datasets/test_guitarset.py @@ -1,3 +1,4 @@ +import os import numpy as np import jams @@ -5,7 +6,7 @@ from mirdata import annotations from tests.test_utils import run_track_tests -TEST_DATA_HOME = "tests/resources/mir_datasets/guitarset" +TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/guitarset") def test_track(): @@ -15,16 +16,16 @@ def test_track(): expected_attributes = { "track_id": "03_BN3-119-G_solo", - "audio_hex_cln_path": "tests/resources/mir_datasets/guitarset/" - + "audio_hex-pickup_debleeded/03_BN3-119-G_solo_hex_cln.wav", - "audio_hex_path": "tests/resources/mir_datasets/guitarset/" - + "audio_hex-pickup_original/03_BN3-119-G_solo_hex.wav", - "audio_mic_path": "tests/resources/mir_datasets/guitarset/" - + "audio_mono-mic/03_BN3-119-G_solo_mic.wav", - "audio_mix_path": "tests/resources/mir_datasets/guitarset/" - + "audio_mono-pickup_mix/03_BN3-119-G_solo_mix.wav", - "jams_path": "tests/resources/mir_datasets/guitarset/" - + "annotation/03_BN3-119-G_solo.jams", + "audio_hex_cln_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") + , "audio_hex-pickup_debleeded/03_BN3-119-G_solo_hex_cln.wav"), + "audio_hex_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") + , "audio_hex-pickup_original/03_BN3-119-G_solo_hex.wav"), + "audio_mic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") + , "audio_mono-mic/03_BN3-119-G_solo_mic.wav"), + "audio_mix_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") + , "audio_mono-pickup_mix/03_BN3-119-G_solo_mix.wav"), + "jams_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") + , "annotation/03_BN3-119-G_solo.jams"), "player_id": "03", "tempo": 119, "mode": "solo", diff --git a/tests/datasets/test_haydn_op20.py b/tests/datasets/test_haydn_op20.py index 36f1e70ad..dabfb367e 100644 --- a/tests/datasets/test_haydn_op20.py +++ b/tests/datasets/test_haydn_op20.py @@ -1,4 +1,14 @@ -import music21 +import logging +import os + +try: + import music21 +except ImportError: + logging.error( + "In order to use haydn_op20 you must have music21 installed. " + "Please reinstall mirdata using `pip install 'mirdata[haydn_op20] and re-run the tests." + ) + raise ImportError from mirdata.annotations import KeyData, ChordData from mirdata.datasets import haydn_op20 @@ -9,12 +19,12 @@ def test_track(): default_trackid = "0" - data_home = "tests/resources/mir_datasets/haydn_op20" + data_home = os.path.normpath("tests/resources/mir_datasets/haydn_op20") dataset = haydn_op20.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "humdrum_annotated_path": "tests/resources/mir_datasets/haydn_op20/op20n1-01.hrm", + "humdrum_annotated_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.hrm"), "title": "op20n1-01", "track_id": "0", } @@ -33,7 +43,7 @@ def test_track(): def test_to_jam(): - data_home = "tests/resources/mir_datasets/haydn_op20" + data_home = os.path.normpath("tests/resources/mir_datasets/haydn_op20") dataset = haydn_op20.Dataset(data_home) track = dataset.track("0") jam = track.to_jams() @@ -41,11 +51,11 @@ def test_to_jam(): assert jam["file_metadata"]["duration"] == 644, "duration does not match expected" assert ( jam["sandbox"]["humdrum_annotated_path"] - == "tests/resources/mir_datasets/haydn_op20/op20n1-01.hrm" + == os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.hrm") ), "duration does not match expected" assert ( jam["sandbox"]["midi_path"] - == "tests/resources/mir_datasets/haydn_op20/op20n1-01.midi" + == os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.midi") ), "duration does not match expected" assert isinstance(jam["sandbox"]["chords_music21"], list) assert jam["sandbox"]["chords_music21"][0]["time"] == 0 diff --git a/tests/datasets/test_ikala.py b/tests/datasets/test_ikala.py index dab1a1a14..73c5099bb 100644 --- a/tests/datasets/test_ikala.py +++ b/tests/datasets/test_ikala.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import ikala @@ -7,20 +8,20 @@ def test_track(): default_trackid = "10161_chorus" - data_home = "tests/resources/mir_datasets/ikala" + data_home = os.path.normpath("tests/resources/mir_datasets/ikala") dataset = ikala.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "10161_chorus", - "audio_path": "tests/resources/mir_datasets/ikala/" - + "Wavfile/10161_chorus.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/") + , "Wavfile/10161_chorus.wav"), "song_id": "10161", "section": "chorus", "singer_id": "1", - "f0_path": "tests/resources/mir_datasets/ikala/PitchLabel/10161_chorus.pv", - "lyrics_path": "tests/resources/mir_datasets/ikala/Lyrics/10161_chorus.lab", - "notes_pyin_path": "tests/resources/mir_datasets/ikala/ikala-pyin-notes/10161_chorus_vamp_pyin_pyin_notes.csv", + "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"PitchLabel/10161_chorus.pv"), + "lyrics_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"Lyrics/10161_chorus.lab"), + "notes_pyin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"ikala-pyin-notes/10161_chorus_vamp_pyin_pyin_notes.csv"), } expected_property_types = { diff --git a/tests/datasets/test_irmas.py b/tests/datasets/test_irmas.py index 5120f25c2..f628007ac 100644 --- a/tests/datasets/test_irmas.py +++ b/tests/datasets/test_irmas.py @@ -7,15 +7,15 @@ def test_track(): default_trackid = "1" default_trackid_train = "0189__2" - data_home = "tests/resources/mir_datasets/irmas" + data_home = os.path.normpath("tests/resources/mir_datasets/irmas") dataset = irmas.Dataset(data_home) track = dataset.track(default_trackid) track_train = dataset.track(default_trackid_train) expected_attributes = { - "annotation_path": "tests/resources/mir_datasets/irmas/IRMAS-TestingData-Part1/Part1/" - + "02 - And The Body Will Die-8.txt", - "audio_path": "tests/resources/mir_datasets/irmas/IRMAS-TestingData-Part1/Part1/" - + "02 - And The Body Will Die-8.wav", + "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") + , "IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.txt"), + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") + ,"IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.wav"), "track_id": "1", "predominant_instrument": None, "genre": None, @@ -24,10 +24,10 @@ def test_track(): "train": False, } expected_attributes_train = { - "annotation_path": "tests/resources/mir_datasets/irmas/IRMAS-TrainingData/cla/" - + "[cla][cla]0189__2.wav", - "audio_path": "tests/resources/mir_datasets/irmas/IRMAS-TrainingData/cla/" - + "[cla][cla]0189__2.wav", + "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") + ,"IRMAS-TrainingData/cla/[cla][cla]0189__2.wav"), + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") + ,"IRMAS-TrainingData/cla/[cla][cla]0189__2.wav"), "track_id": "0189__2", "predominant_instrument": "cla", "genre": "cla", diff --git a/tests/datasets/test_jingju_acappella.py b/tests/datasets/test_jingju_acappella.py index c93c641ba..ad85d525a 100644 --- a/tests/datasets/test_jingju_acappella.py +++ b/tests/datasets/test_jingju_acappella.py @@ -2,10 +2,10 @@ from mirdata import annotations from mirdata.datasets import compmusic_jingju_acappella from tests.test_utils import run_track_tests - +import os def test_track(): - data_home = "tests/resources/mir_datasets/compmusic_jingju_acappella" + data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella") track_id = "lseh-Tan_Yang_jia-Hong_yang_dong-qm" dataset = compmusic_jingju_acappella.Dataset(data_home) @@ -13,19 +13,19 @@ def test_track(): expected_attributes = { "track_id": "lseh-Tan_Yang_jia-Hong_yang_dong-qm", - "audio_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "wav/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.wav", - "phrase_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase.txt", - "phrase_char_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase_char.txt", - "phoneme_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phoneme.txt", - "syllable_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_syllable.txt", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "wav/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.wav"), + "phrase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase.txt"), + "phrase_char_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase_char.txt"), + "phoneme_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phoneme.txt"), + "syllable_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_syllable.txt"), "title": "Türk Müziğinde 75 Büyük Bestekar/ 75 Great Composers In Turkish Classical Music", - "textgrid_path": "tests/resources/mir_datasets/compmusic_jingju_acappella/" - + "textgrid/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.TextGrid", + "textgrid_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") + , "textgrid/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.TextGrid"), "work": "“叹杨家投宋主心血用尽”——《洪羊洞》(杨延昭)", "details": None, } diff --git a/tests/datasets/test_medley_solos_db.py b/tests/datasets/test_medley_solos_db.py index 06b09d2bd..79026b8ac 100644 --- a/tests/datasets/test_medley_solos_db.py +++ b/tests/datasets/test_medley_solos_db.py @@ -1,17 +1,18 @@ +import os from mirdata.datasets import medley_solos_db from tests.test_utils import run_track_tests def test_track(): default_trackid = "d07b1fc0-567d-52c2-fef4-239f31c9d40e" - data_home = "tests/resources/mir_datasets/medley_solos_db" + data_home = os.path.normpath("tests/resources/mir_datasets/medley_solos_db") dataset = medley_solos_db.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "d07b1fc0-567d-52c2-fef4-239f31c9d40e", - "audio_path": "tests/resources/mir_datasets/medley_solos_db/" - + "audio/Medley-solos-DB_validation-3_d07b1fc0-567d-52c2-fef4-239f31c9d40e.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medley_solos_db/") + , "audio/Medley-solos-DB_validation-3_d07b1fc0-567d-52c2-fef4-239f31c9d40e.wav"), "instrument": "flute", "instrument_id": 3, "song_id": 210, diff --git a/tests/datasets/test_medleydb_melody.py b/tests/datasets/test_medleydb_melody.py index 7035e8fbb..1fb66680f 100644 --- a/tests/datasets/test_medleydb_melody.py +++ b/tests/datasets/test_medleydb_melody.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import medleydb_melody @@ -7,20 +8,20 @@ def test_track(): default_trackid = "MusicDelta_Beethoven" - data_home = "tests/resources/mir_datasets/medleydb_melody" + data_home = os.path.normpath("tests/resources/mir_datasets/medleydb_melody") dataset = medleydb_melody.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "MusicDelta_Beethoven", - "audio_path": "tests/resources/mir_datasets/" - + "medleydb_melody/audio/MusicDelta_Beethoven_MIX.wav", - "melody1_path": "tests/resources/mir_datasets/" - + "medleydb_melody/melody1/MusicDelta_Beethoven_MELODY1.csv", - "melody2_path": "tests/resources/mir_datasets/" - + "medleydb_melody/melody2/MusicDelta_Beethoven_MELODY2.csv", - "melody3_path": "tests/resources/mir_datasets/" - + "medleydb_melody/melody3/MusicDelta_Beethoven_MELODY3.csv", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") + , "audio/MusicDelta_Beethoven_MIX.wav"), + "melody1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") + , "melody1/MusicDelta_Beethoven_MELODY1.csv"), + "melody2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") + , "melody2/MusicDelta_Beethoven_MELODY2.csv"), + "melody3_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") + , "melody3/MusicDelta_Beethoven_MELODY3.csv"), "artist": "MusicDelta", "title": "Beethoven", "genre": "Classical", diff --git a/tests/datasets/test_medleydb_pitch.py b/tests/datasets/test_medleydb_pitch.py index 78a1b3cef..b7b68c850 100644 --- a/tests/datasets/test_medleydb_pitch.py +++ b/tests/datasets/test_medleydb_pitch.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import medleydb_pitch @@ -7,19 +8,18 @@ def test_track(): default_trackid = "AClassicEducation_NightOwl_STEM_08" - data_home = "tests/resources/mir_datasets/medleydb_pitch" + data_home = os.path.normpath("tests/resources/mir_datasets/medleydb_pitch") dataset = medleydb_pitch.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "AClassicEducation_NightOwl_STEM_08", - "audio_path": "tests/resources/mir_datasets/" - + "medleydb_pitch/audio/AClassicEducation_NightOwl_STEM_08.wav", - "pitch_path": "tests/resources/mir_datasets/" - + "medleydb_pitch/pitch/AClassicEducation_NightOwl_STEM_08.csv", - "notes_pyin_path": "tests/resources/mir_datasets/medleydb_pitch/" - + "medleydb-pitch-pyin-notes/AClassicEducation_" - + "NightOwl_STEM_08_vamp_pyin_pyin_notes.csv", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") + , "audio/AClassicEducation_NightOwl_STEM_08.wav"), + "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") + , "pitch/AClassicEducation_NightOwl_STEM_08.csv"), + "notes_pyin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") + , "medleydb-pitch-pyin-notes/AClassicEducation_NightOwl_STEM_08_vamp_pyin_pyin_notes.csv"), "instrument": "male singer", "artist": "AClassicEducation", "title": "NightOwl", diff --git a/tests/datasets/test_mridangam_stroke.py b/tests/datasets/test_mridangam_stroke.py index 0709eeeca..a4bff6cb3 100644 --- a/tests/datasets/test_mridangam_stroke.py +++ b/tests/datasets/test_mridangam_stroke.py @@ -7,12 +7,12 @@ def test_track(): default_trackid = "224030" - data_home = "tests/resources/mir_datasets/mridangam_stroke" + data_home = os.path.normpath("tests/resources/mir_datasets/mridangam_stroke") dataset = mridangam_stroke.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/mridangam_stroke/mridangam_stroke_1.5/" - + "B/224030__akshaylaya__bheem-b-001.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/mridangam_stroke/") + ,"mridangam_stroke_1.5/B/224030__akshaylaya__bheem-b-001.wav"), "track_id": "224030", "stroke_name": "bheem", "tonic": "B", diff --git a/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py b/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py index 33a31505b..0482535c4 100644 --- a/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py +++ b/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py @@ -1,3 +1,4 @@ +import os import numpy as np import pytest @@ -7,13 +8,13 @@ def test_track(): default_trackid = "track_0000948" - data_home = "tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme" + data_home = os.path.normpath("tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme") dataset = mtg_jamendo_autotagging_moodtheme.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "audio_path": ( - "tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme/audios/48/948.mp3" + os.path.join(os.path.normpath("tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme/"),"audios/48/948.mp3") ), "track_id": "track_0000948", } diff --git a/tests/datasets/test_openmic2018.py b/tests/datasets/test_openmic2018.py index c11f2daa1..c07357e31 100644 --- a/tests/datasets/test_openmic2018.py +++ b/tests/datasets/test_openmic2018.py @@ -8,14 +8,14 @@ def test_track(): default_trackid = "000046_3840" - data_home = "tests/resources/mir_datasets/openmic2018" + data_home = os.path.normpath("tests/resources/mir_datasets/openmic2018") dataset = openmic2018.Dataset(data_home, version="test") track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/openmic2018/audio/000/000046_3840.ogg", - "vggish_path": "tests/resources/mir_datasets/openmic2018/vggish/000/000046_3840.json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/openmic2018/"),"audio/000/000046_3840.ogg"), + "vggish_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/openmic2018/"),"vggish/000/000046_3840.json"), "track_id": "000046_3840", "title": "Yosemite", "artist": "Nicky Cook", diff --git a/tests/datasets/test_orchset.py b/tests/datasets/test_orchset.py index 90db6b808..4696b4223 100644 --- a/tests/datasets/test_orchset.py +++ b/tests/datasets/test_orchset.py @@ -9,18 +9,18 @@ def test_track(): default_trackid = "Beethoven-S3-I-ex1" - data_home = "tests/resources/mir_datasets/orchset" + data_home = os.path.normpath("tests/resources/mir_datasets/orchset") dataset = orchset.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "Beethoven-S3-I-ex1", - "audio_path_mono": "tests/resources/mir_datasets/orchset/" - + "audio/mono/Beethoven-S3-I-ex1.wav", - "audio_path_stereo": "tests/resources/mir_datasets/orchset/" - + "audio/stereo/Beethoven-S3-I-ex1.wav", - "melody_path": "tests/resources/mir_datasets/orchset/" - + "GT/Beethoven-S3-I-ex1.mel", + "audio_path_mono": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") + , "audio/mono/Beethoven-S3-I-ex1.wav"), + "audio_path_stereo": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") + , "audio/stereo/Beethoven-S3-I-ex1.wav"), + "melody_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") + , "GT/Beethoven-S3-I-ex1.mel"), "composer": "Beethoven", "work": "S3-I", "excerpt": "1", diff --git a/tests/datasets/test_otmm_makam.py b/tests/datasets/test_otmm_makam.py index 79302c625..9525caba6 100644 --- a/tests/datasets/test_otmm_makam.py +++ b/tests/datasets/test_otmm_makam.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations from mirdata.datasets import compmusic_otmm_makam @@ -5,7 +6,7 @@ def test_track(): - data_home = "tests/resources/mir_datasets/compmusic_otmm_makam" + data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam") track_id = "cafcdeaf-e966-4ff0-84fb-f660d2b68365" dataset = compmusic_otmm_makam.Dataset(data_home) @@ -13,10 +14,10 @@ def test_track(): expected_attributes = { "track_id": "cafcdeaf-e966-4ff0-84fb-f660d2b68365", - "pitch_path": "tests/resources/mir_datasets/compmusic_otmm_makam/" - + "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.pitch", - "mb_tags_path": "tests/resources/mir_datasets/compmusic_otmm_makam/" - + "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.json", + "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/") + , "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.pitch"), + "mb_tags_path":os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/") + , "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.json"), "form": "sarki", "instrumentation": "Solo vocal with accompaniment", "mb_url": "http://musicbrainz.org/work/cafcdeaf-e966-4ff0-84fb-f660d2b68365", @@ -479,7 +480,7 @@ def test_load_pitch(): def test_load_metadata(): - data_home = "tests/resources/mir_datasets/compmusic_otmm_makam" + data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam") dataset = compmusic_otmm_makam.Dataset(data_home) metadata = dataset._metadata diff --git a/tests/datasets/test_phenicx_anechoic.py b/tests/datasets/test_phenicx_anechoic.py index 271a7e292..e1ddeef86 100644 --- a/tests/datasets/test_phenicx_anechoic.py +++ b/tests/datasets/test_phenicx_anechoic.py @@ -10,26 +10,26 @@ def test_track(): default_trackid = "beethoven-violin" - data_home = "tests/resources/mir_datasets/phenicx_anechoic" + data_home = os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic") dataset = phenicx_anechoic.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "beethoven-violin", "audio_paths": [ - "tests/resources/mir_datasets/phenicx_anechoic/" - + "audio/beethoven/violin1.wav", - "tests/resources/mir_datasets/phenicx_anechoic/" - + "audio/beethoven/violin2.wav", - "tests/resources/mir_datasets/phenicx_anechoic/" - + "audio/beethoven/violin3.wav", - "tests/resources/mir_datasets/phenicx_anechoic/" - + "audio/beethoven/violin4.wav", + os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "audio/beethoven/violin1.wav"), + os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "audio/beethoven/violin2.wav"), + os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "audio/beethoven/violin3.wav"), + os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "audio/beethoven/violin4.wav"), ], - "notes_path": "tests/resources/mir_datasets/phenicx_anechoic/" - + "annotations/beethoven/violin.txt", - "notes_original_path": "tests/resources/mir_datasets/phenicx_anechoic/" - + "annotations/beethoven/violin_o.txt", + "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "annotations/beethoven/violin.txt"), + "notes_original_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") + , "annotations/beethoven/violin_o.txt"), "instrument": "violin", "piece": "beethoven", "n_voices": 4, diff --git a/tests/datasets/test_queen.py b/tests/datasets/test_queen.py index ea0c15e41..ad0e35888 100644 --- a/tests/datasets/test_queen.py +++ b/tests/datasets/test_queen.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations @@ -7,18 +8,18 @@ def test_track(): default_trackid = "0" - data_home = "tests/resources/mir_datasets/queen" + data_home = os.path.normpath("tests/resources/mir_datasets/queen") dataset = queen.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/queen/audio/Greatest Hits I/01 Bohemian Rhapsody.flac", - "chords_path": "tests/resources/mir_datasets/queen/" - "annotations/chordlab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", - "keys_path": "tests/resources/mir_datasets/queen/" - + "annotations/keylab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", - "sections_path": "tests/resources/mir_datasets/queen/" - + "annotations/seglab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/"),"audio/Greatest Hits I/01 Bohemian Rhapsody.flac"), + "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") + ,"annotations/chordlab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), + "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") + , "annotations/keylab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") + , "annotations/seglab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), "title": "01 Bohemian Rhapsody", "track_id": "0", } diff --git a/tests/datasets/test_rwc_classical.py b/tests/datasets/test_rwc_classical.py index cbfe08e8a..16219db09 100644 --- a/tests/datasets/test_rwc_classical.py +++ b/tests/datasets/test_rwc_classical.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import rwc_classical @@ -7,18 +8,18 @@ def test_track(): default_trackid = "RM-C003" - data_home = "tests/resources/mir_datasets/rwc_classical" + data_home = os.path.normpath("tests/resources/mir_datasets/rwc_classical") dataset = rwc_classical.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "RM-C003", - "audio_path": "tests/resources/mir_datasets/rwc_classical/" - + "audio/rwc-c-m01/3.wav", - "sections_path": "tests/resources/mir_datasets/rwc_classical/" - + "annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C003.CHORUS.TXT", - "beats_path": "tests/resources/mir_datasets/rwc_classical/" - + "annotations/AIST.RWC-MDB-C-2001.BEAT/RM-C003.BEAT.TXT", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") + , "audio/rwc-c-m01/3.wav"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") + , "annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C003.CHORUS.TXT"), + "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") + , "annotations/AIST.RWC-MDB-C-2001.BEAT/RM-C003.BEAT.TXT"), "piece_number": "No. 3", "suffix": "M01", "track_number": "Tr. 03", diff --git a/tests/datasets/test_rwc_jazz.py b/tests/datasets/test_rwc_jazz.py index b74ebf3dd..da077d27f 100644 --- a/tests/datasets/test_rwc_jazz.py +++ b/tests/datasets/test_rwc_jazz.py @@ -1,3 +1,4 @@ +import os from mirdata.datasets import rwc_jazz from mirdata import annotations from tests.test_utils import run_track_tests @@ -6,18 +7,18 @@ def test_track(): default_trackid = "RM-J004" - data_home = "tests/resources/mir_datasets/rwc_jazz" + data_home = os.path.normpath("tests/resources/mir_datasets/rwc_jazz") dataset = rwc_jazz.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "RM-J004", - "audio_path": "tests/resources/mir_datasets/rwc_jazz/" - + "audio/rwc-j-m01/4.wav", - "sections_path": "tests/resources/mir_datasets/rwc_jazz/" - + "annotations/AIST.RWC-MDB-J-2001.CHORUS/RM-J004.CHORUS.TXT", - "beats_path": "tests/resources/mir_datasets/rwc_jazz/" - + "annotations/AIST.RWC-MDB-J-2001.BEAT/RM-J004.BEAT.TXT", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") + , "audio/rwc-j-m01/4.wav"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") + , "annotations/AIST.RWC-MDB-J-2001.CHORUS/RM-J004.CHORUS.TXT"), + "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") + , "annotations/AIST.RWC-MDB-J-2001.BEAT/RM-J004.BEAT.TXT"), "piece_number": "No. 4", "suffix": "M01", "track_number": "Tr. 04", @@ -125,7 +126,7 @@ def test_load_metadata(): "suffix": "M04", "track_number": "Tr. 09", "title": "Joyful, Joyful, We Adore Thee", - "artist": "K’s Band", + "artist": (u"K’s Band"), "duration": 270, "variation": "Style (Free jazz)", "instruments": "Pf & Bs & Dr & Gt & Ts & Fl & Bar", diff --git a/tests/datasets/test_rwc_popular.py b/tests/datasets/test_rwc_popular.py index 9043a4f90..b327adf3e 100644 --- a/tests/datasets/test_rwc_popular.py +++ b/tests/datasets/test_rwc_popular.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import rwc_popular @@ -8,22 +9,22 @@ def test_track(): default_trackid = "RM-P001" - data_home = "tests/resources/mir_datasets/rwc_popular" + data_home = os.path.normpath("tests/resources/mir_datasets/rwc_popular") dataset = rwc_popular.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "RM-P001", - "audio_path": "tests/resources/mir_datasets/rwc_popular/" - + "audio/rwc-p-m01/1.wav", - "sections_path": "tests/resources/mir_datasets/rwc_popular/" - + "annotations/AIST.RWC-MDB-P-2001.CHORUS/RM-P001.CHORUS.TXT", - "beats_path": "tests/resources/mir_datasets/rwc_popular/" - + "annotations/AIST.RWC-MDB-P-2001.BEAT/RM-P001.BEAT.TXT", - "chords_path": "tests/resources/mir_datasets/rwc_popular/" - + "annotations/AIST.RWC-MDB-P-2001.CHORD/RWC_Pop_Chords/N001-M01-T01.lab", - "voca_inst_path": "tests/resources/mir_datasets/rwc_popular/" - + "annotations/AIST.RWC-MDB-P-2001.VOCA_INST/RM-P001.VOCA_INST.TXT", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") + , "audio/rwc-p-m01/1.wav"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") + , "annotations/AIST.RWC-MDB-P-2001.CHORUS/RM-P001.CHORUS.TXT"), + "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") + , "annotations/AIST.RWC-MDB-P-2001.BEAT/RM-P001.BEAT.TXT"), + "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") + , "annotations/AIST.RWC-MDB-P-2001.CHORD/RWC_Pop_Chords/N001-M01-T01.lab"), + "voca_inst_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") + , "annotations/AIST.RWC-MDB-P-2001.VOCA_INST/RM-P001.VOCA_INST.TXT"), "piece_number": "No. 1", "suffix": "M01", "track_number": "Tr. 01", diff --git a/tests/datasets/test_salami.py b/tests/datasets/test_salami.py index d6e0ab5cc..69532b016 100644 --- a/tests/datasets/test_salami.py +++ b/tests/datasets/test_salami.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import salami from mirdata import annotations @@ -7,21 +8,21 @@ def test_track(): default_trackid = "2" - data_home = "tests/resources/mir_datasets/salami" + data_home = os.path.normpath("tests/resources/mir_datasets/salami") dataset = salami.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "2", - "audio_path": "tests/resources/mir_datasets/salami/" + "audio/2.mp3", - "sections_annotator1_uppercase_path": "tests/resources/mir_datasets/salami/" - + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_uppercase.txt", - "sections_annotator1_lowercase_path": "tests/resources/mir_datasets/salami/" - + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_lowercase.txt", - "sections_annotator2_uppercase_path": "tests/resources/mir_datasets/salami/" - + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_uppercase.txt", - "sections_annotator2_lowercase_path": "tests/resources/mir_datasets/salami/" - + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_lowercase.txt", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/"), "audio/2.mp3"), + "sections_annotator1_uppercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") + , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_uppercase.txt"), + "sections_annotator1_lowercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") + , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_lowercase.txt"), + "sections_annotator2_uppercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") + , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_uppercase.txt"), + "sections_annotator2_lowercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") + , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_lowercase.txt"), "source": "Codaich", "annotator_1_id": "5", "annotator_2_id": "8", diff --git a/tests/datasets/test_saraga_carnatic.py b/tests/datasets/test_saraga_carnatic.py index 85a43a1da..17dacc00b 100644 --- a/tests/datasets/test_saraga_carnatic.py +++ b/tests/datasets/test_saraga_carnatic.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations from mirdata.datasets import saraga_carnatic @@ -6,55 +7,55 @@ def test_track(): default_trackid = "116_Bhuvini_Dasudane" - data_home = "tests/resources/mir_datasets/saraga_carnatic" + data_home = os.path.normpath("tests/resources/mir_datasets/saraga_carnatic") dataset = saraga_carnatic.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "116_Bhuvini_Dasudane", - "audio_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.mp3.mp3", - "audio_ghatam_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-ghatam.mp3", - "audio_mridangam_left_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-left.mp3", - "audio_mridangam_right_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-right.mp3", - "audio_violin_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-violin.mp3", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.mp3.mp3"), + "audio_ghatam_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-ghatam.mp3"), + "audio_mridangam_left_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-left.mp3"), + "audio_mridangam_right_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-right.mp3"), + "audio_violin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-violin.mp3"), "audio_vocal_s_path": None, - "audio_vocal_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-vocal.mp3", - "ctonic_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.ctonic.txt", - "pitch_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.pitch.txt", - "pitch_vocal_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.pitch-vocal.txt", - "tempo_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.tempo-manual.txt", - "sama_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.sama-manual.txt", - "sections_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.sections-manual-p.txt", - "phrases_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.mphrases-manual.txt", - "metadata_path": "tests/resources/mir_datasets/saraga_carnatic/saraga1.5_carnatic/" - + "Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - + "Bhuvini Dasudane/Bhuvini Dasudane.json", + "audio_vocal_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-vocal.mp3"), + "ctonic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.ctonic.txt"), + "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.pitch.txt"), + "pitch_vocal_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.pitch-vocal.txt"), + "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.tempo-manual.txt"), + "sama_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.sama-manual.txt"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.sections-manual-p.txt"), + "phrases_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.mphrases-manual.txt"), + "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") + , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" + , "Bhuvini Dasudane/Bhuvini Dasudane.json"), } expected_property_types = { diff --git a/tests/datasets/test_saraga_hindustani.py b/tests/datasets/test_saraga_hindustani.py index 71d545207..de78ea238 100644 --- a/tests/datasets/test_saraga_hindustani.py +++ b/tests/datasets/test_saraga_hindustani.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations from mirdata.datasets import saraga_hindustani @@ -7,29 +8,29 @@ def test_track(): default_trackid = "50_Irani_Bhairavi_Thumri" - data_home = "tests/resources/mir_datasets/saraga_hindustani" + data_home = os.path.normpath("tests/resources/mir_datasets/saraga_hindustani") dataset = saraga_hindustani.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "50_Irani_Bhairavi_Thumri", "title": "Irani Bhairavi Thumri", - "audio_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mp3.mp3", - "ctonic_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.ctonic.txt", - "pitch_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.pitch.txt", - "tempo_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.tempo-manual.txt", - "sama_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sama-manual.txt", - "sections_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sections-manual-p.txt", - "phrases_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mphrases-manual.txt", - "metadata_path": "tests/resources/mir_datasets/saraga_hindustani/saraga1.5_hindustani/" - + "New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + ,"saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mp3.mp3"), + "ctonic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.ctonic.txt"), + "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.pitch.txt"), + "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.tempo-manual.txt"), + "sama_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sama-manual.txt"), + "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sections-manual-p.txt"), + "phrases_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mphrases-manual.txt"), + "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") + , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.json"), } expected_property_types = { diff --git a/tests/datasets/test_slakh.py b/tests/datasets/test_slakh.py index 8c5f79170..cb70555b8 100644 --- a/tests/datasets/test_slakh.py +++ b/tests/datasets/test_slakh.py @@ -1,3 +1,4 @@ +import os import pretty_midi from mirdata import annotations @@ -7,7 +8,7 @@ def test_track(): default_trackid = "Track00001-S00" - data_home = "tests/resources/mir_datasets/slakh" + data_home = os.path.normpath("tests/resources/mir_datasets/slakh") dataset = slakh.Dataset(data_home, version="test") track = dataset.track(default_trackid) @@ -15,10 +16,10 @@ def test_track(): expected_attributes = { "track_id": "Track00001-S00", "mtrack_id": "Track00001", - "audio_path": "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/stems/S00.wav", - "midi_path": "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/MIDI/S00.mid", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/stems/S00.wav"), + "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/MIDI/S00.mid"), "metadata_path": ( - "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/metadata.yaml" + os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/metadata.yaml") ), "instrument": "Guitar", "integrated_loudness": -12.82074180245363, @@ -68,19 +69,19 @@ def test_track(): def test_track_full(): default_trackid = "Track00001-S00" - data_home = "tests/resources/mir_datasets/slakh" + data_home = os.path.normpath("tests/resources/mir_datasets/slakh") dataset_full = slakh.Dataset(data_home, version="2100-redux") track_full = dataset_full.track(default_trackid) expected_attributes = { "track_id": "Track00001-S00", "mtrack_id": "Track00001", - "audio_path": "tests/resources/mir_datasets/slakh/slakh2100_flac_redux/train/Track00001/stems/S00.flac", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/stems/S00.flac"), "midi_path": ( - "tests/resources/mir_datasets/slakh/slakh2100_flac_redux/train/Track00001/MIDI/S00.mid" + os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/MIDI/S00.mid") ), "metadata_path": ( - "tests/resources/mir_datasets/slakh/slakh2100_flac_redux/train/Track00001/metadata.yaml" + os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/metadata.yaml") ), "instrument": "Guitar", "integrated_loudness": -12.82074180245363, @@ -158,16 +159,16 @@ def test_to_jams(): def test_multitrack(): default_trackid = "Track00001" - data_home = "tests/resources/mir_datasets/slakh" + data_home = os.path.normpath("tests/resources/mir_datasets/slakh") dataset = slakh.Dataset(data_home, version="test") mtrack = dataset.multitrack(default_trackid) expected_attributes = { "mtrack_id": "Track00001", - "midi_path": "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/all_src.mid", - "mix_path": "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/mix.wav", + "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/all_src.mid"), + "mix_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/mix.wav"), "metadata_path": ( - "tests/resources/mir_datasets/slakh/babyslakh_16k/Track00001/metadata.yaml" + os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/metadata.yaml") ), "data_split": None, "track_ids": [ diff --git a/tests/datasets/test_tinysol.py b/tests/datasets/test_tinysol.py index 9f96cf80c..f86f397c2 100644 --- a/tests/datasets/test_tinysol.py +++ b/tests/datasets/test_tinysol.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata.datasets import tinysol @@ -6,14 +7,14 @@ def test_track(): default_trackid = "Fl-ord-C4-mf-N-T14d" - data_home = "tests/resources/mir_datasets/tinysol" + data_home = os.path.normpath("tests/resources/mir_datasets/tinysol") dataset = tinysol.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "Fl-ord-C4-mf-N-T14d", - "audio_path": "tests/resources/mir_datasets/tinysol/" - + "audio/Winds/Flute/ordinario/Fl-ord-C4-mf-N-T14d.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tinysol/") + , "audio/Winds/Flute/ordinario/Fl-ord-C4-mf-N-T14d.wav"), "dynamics": "mf", "fold": 0, "family": "Winds", diff --git a/tests/datasets/test_tonality_classicaldb.py b/tests/datasets/test_tonality_classicaldb.py index 5eea0204a..c58042fc6 100644 --- a/tests/datasets/test_tonality_classicaldb.py +++ b/tests/datasets/test_tonality_classicaldb.py @@ -1,3 +1,4 @@ +import os import sys import librosa @@ -9,16 +10,16 @@ def test_track(): default_trackid = "0" - data_home = "tests/resources/mir_datasets/tonality_classicaldb" + data_home = os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb") dataset = tonality_classicaldb.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/tonality_classicaldb/audio/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.wav", - "key_path": "tests/resources/mir_datasets/tonality_classicaldb/keys/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.txt", - "spectrum_path": "tests/resources/mir_datasets/tonality_classicaldb/spectrums/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", - "hpcp_path": "tests/resources/mir_datasets/tonality_classicaldb/HPCPs/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", - "musicbrainz_path": "tests/resources/mir_datasets/tonality_classicaldb/musicbrainz_metadata/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"audio/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.wav"), + "key_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"keys/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.txt"), + "spectrum_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"spectrums/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), + "hpcp_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"HPCPs/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), + "musicbrainz_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"musicbrainz_metadata/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), "title": "01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D", "track_id": "0", } diff --git a/tests/datasets/test_tonas.py b/tests/datasets/test_tonas.py index a765ce6d1..d75c82585 100644 --- a/tests/datasets/test_tonas.py +++ b/tests/datasets/test_tonas.py @@ -1,3 +1,4 @@ +import os import numpy as np from tests.test_utils import run_track_tests @@ -5,7 +6,7 @@ from mirdata import annotations from mirdata.datasets import tonas -TEST_DATA_HOME = "tests/resources/mir_datasets/tonas" +TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/tonas") def test_track(): @@ -18,9 +19,9 @@ def test_track(): "style": "Debla", "title": "Antonio Mairena", "tuning_frequency": 451.0654725341684, - "f0_path": "tests/resources/mir_datasets/tonas/Deblas/01-D_AMairena.f0.Corrected", - "notes_path": "tests/resources/mir_datasets/tonas/Deblas/01-D_AMairena.notes.Corrected", - "audio_path": "tests/resources/mir_datasets/tonas/Deblas/01-D_AMairena.wav", + "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.f0.Corrected"), + "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.notes.Corrected"), + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.wav"), "track_id": "01-D_AMairena", } diff --git a/tests/datasets/test_vocadito.py b/tests/datasets/test_vocadito.py index ca8ea0df1..fb670ef59 100644 --- a/tests/datasets/test_vocadito.py +++ b/tests/datasets/test_vocadito.py @@ -1,3 +1,4 @@ +import os from typing import List import numpy as np @@ -9,20 +10,20 @@ def test_track(): default_trackid = "1" - data_home = "tests/resources/mir_datasets/vocadito" + data_home = os.path.normpath("tests/resources/mir_datasets/vocadito") dataset = vocadito.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "1", - "audio_path": "tests/resources/mir_datasets/vocadito/Audio/vocadito_1.wav", + "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Audio/vocadito_1.wav"), "singer_id": "S1", "language": "Tagalog", "average_pitch_midi": 50, - "f0_path": "tests/resources/mir_datasets/vocadito/Annotations/F0/vocadito_1_f0.csv", - "lyrics_path": "tests/resources/mir_datasets/vocadito/Annotations/Lyrics/vocadito_1_lyrics.txt", - "notes_a1_path": "tests/resources/mir_datasets/vocadito/Annotations/Notes/vocadito_1_notesA1.csv", - "notes_a2_path": "tests/resources/mir_datasets/vocadito/Annotations/Notes/vocadito_1_notesA2.csv", + "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/F0/vocadito_1_f0.csv"), + "lyrics_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Lyrics/vocadito_1_lyrics.txt"), + "notes_a1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Notes/vocadito_1_notesA1.csv"), + "notes_a2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Notes/vocadito_1_notesA2.csv"), } expected_property_types = { From 79e3f6cc5f4c57b43ac0b31b2e95b4133a1baec4 Mon Sep 17 00:00:00 2001 From: Harsh Palan Date: Tue, 22 Nov 2022 14:58:02 -0500 Subject: [PATCH 3/5] updating datasets with issues for Windows --- mirdata/datasets/acousticbrainz_genre.py | 7 ++++--- mirdata/datasets/compmusic_jingju_acappella.py | 5 +++-- mirdata/datasets/compmusic_otmm_makam.py | 13 ++++++++----- mirdata/datasets/rwc_jazz.py | 1 + mirdata/datasets/saraga_carnatic.py | 2 +- mirdata/datasets/saraga_hindustani.py | 4 +++- mirdata/datasets/slakh.py | 4 ++-- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/mirdata/datasets/acousticbrainz_genre.py b/mirdata/datasets/acousticbrainz_genre.py index faae0dc84..e995b0c34 100644 --- a/mirdata/datasets/acousticbrainz_genre.py +++ b/mirdata/datasets/acousticbrainz_genre.py @@ -39,6 +39,7 @@ """ import json +import os from deprecated.sphinx import deprecated @@ -204,7 +205,7 @@ def __init__( metadata, ) - self.path = self.get_path("data") + self.path = os.path.normpath(self.get_path("data")) self.genre = [genre for genre in self.track_id.split("#")[4:] if genre != ""] self.mbid = self.track_id.split("#")[2] self.mbid_group = self.track_id.split("#")[3] @@ -363,7 +364,7 @@ def rhythm(self): @core.cached_property def acousticbrainz_metadata(self): - return load_extractor(self.path) + return load_extractor(os.path.normpath(self.path)) def to_jams(self): """the track's data in jams format @@ -374,7 +375,7 @@ def to_jams(self): """ return jams_utils.jams_converter( metadata={ - "features": load_extractor(self.path), + "features": load_extractor(os.path.normpath(self.path)), "duration": self.acousticbrainz_metadata["metadata"][ "audio_properties" ]["length"], diff --git a/mirdata/datasets/compmusic_jingju_acappella.py b/mirdata/datasets/compmusic_jingju_acappella.py index 3ede15b7b..5a1fec990 100644 --- a/mirdata/datasets/compmusic_jingju_acappella.py +++ b/mirdata/datasets/compmusic_jingju_acappella.py @@ -281,7 +281,7 @@ def load_phrases(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] lyrics = [] - + fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) @@ -308,7 +308,7 @@ def load_syllable(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] events = [] - + fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) @@ -352,6 +352,7 @@ def _metadata(self): metadata = {} try: with open(metadata_path_laosheng, "r") as fhandle: + fhandle.reconfigure(encoding='utf-8') reader = csv.reader(fhandle, delimiter=",") next(reader) for line in reader: diff --git a/mirdata/datasets/compmusic_otmm_makam.py b/mirdata/datasets/compmusic_otmm_makam.py index bce3c26bb..20237e69a 100644 --- a/mirdata/datasets/compmusic_otmm_makam.py +++ b/mirdata/datasets/compmusic_otmm_makam.py @@ -189,7 +189,7 @@ def load_mb_tags(fhandle: TextIO) -> dict: Dict: metadata of the track """ - + fhandle.reconfigure(encoding="utf-8") return json.load(fhandle) @@ -214,7 +214,7 @@ def __init__(self, data_home=None, version="default"): @core.cached_property def _metadata(self): metadata_path = os.path.join( - self.data_home, + os.path.normpath(self.data_home), "MTG-otmm_makam_recognition_dataset-f14c0d0", "annotations.json", ) @@ -222,6 +222,7 @@ def _metadata(self): metadata = {} try: with open(metadata_path) as f: + f.reconfigure(encoding="utf-8") meta = json.load(f) for i in meta: index = i["mbid"].split("/")[-1] @@ -232,9 +233,11 @@ def _metadata(self): } except FileNotFoundError: raise FileNotFoundError("Metadata not found. Did you run .download()?") - - temp = metadata_path.split("/")[-2] - data_home = metadata_path.split(temp)[0] + + temp = os.path.split(metadata_path)[-2] + # temp = metadata_path.split("/")[-2] + # data_home = metadata_path.split(temp)[0] + data_home = os.path.split(metadata_path)[0] metadata["data_home"] = data_home return metadata diff --git a/mirdata/datasets/rwc_jazz.py b/mirdata/datasets/rwc_jazz.py index 56fbaedae..9b968009c 100644 --- a/mirdata/datasets/rwc_jazz.py +++ b/mirdata/datasets/rwc_jazz.py @@ -245,6 +245,7 @@ def _metadata(self): try: with open(metadata_path, "r") as fhandle: + fhandle.reconfigure(encoding="utf-8") dialect = csv.Sniffer().sniff(fhandle.read(1024)) fhandle.seek(0) reader = csv.reader(fhandle, dialect) diff --git a/mirdata/datasets/saraga_carnatic.py b/mirdata/datasets/saraga_carnatic.py index 97ba7c3aa..0a229fa49 100644 --- a/mirdata/datasets/saraga_carnatic.py +++ b/mirdata/datasets/saraga_carnatic.py @@ -398,7 +398,7 @@ def load_sections(fhandle): """ intervals = [] section_labels = [] - + fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: if line != "\n": diff --git a/mirdata/datasets/saraga_hindustani.py b/mirdata/datasets/saraga_hindustani.py index 0652daa3e..aae2e2e68 100644 --- a/mirdata/datasets/saraga_hindustani.py +++ b/mirdata/datasets/saraga_hindustani.py @@ -288,6 +288,7 @@ def load_tempo(fhandle): """ tempo_annotation = {} + fhandle.reconfigure(encoding="utf-8") head, tail = os.path.split(fhandle.name) sections_path = tail.split(".")[0] + ".sections-manual-p.txt" sections_abs_path = os.path.join(head, sections_path) @@ -295,6 +296,7 @@ def load_tempo(fhandle): sections = [] try: with open(sections_abs_path, "r") as fhandle2: + fhandle2.reconfigure(encoding="utf-8") reader = csv.reader(fhandle2, delimiter=",") for line in reader: if line != "\n": @@ -379,7 +381,7 @@ def load_sections(fhandle): """ intervals = [] section_labels = [] - + fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter=",") for line in reader: if line: diff --git a/mirdata/datasets/slakh.py b/mirdata/datasets/slakh.py index 321e60a2b..8221b0a62 100644 --- a/mirdata/datasets/slakh.py +++ b/mirdata/datasets/slakh.py @@ -138,7 +138,7 @@ def __init__(self, track_id, data_home, dataset_name, index, metadata): # split (train/validation/test/omitted) is part of the relative filepath in the index self.split = None # for baby_slakh, there are no data splits - set to None if index["version"] == "2100-redux": - self.split = self._track_paths["metadata"][0].split(os.sep)[1] + self.split = os.path.normpath(self._track_paths["metadata"][0]).split(os.sep)[1] assert ( self.split in SPLITS ), "{} not a valid split - should be one of {}.".format(self.split, SPLITS) @@ -266,7 +266,7 @@ def __init__( # split (train/validation/test) is determined by the relative filepath in the index self.split = None # for baby_slakh, there are no data splits - set to None if index["version"] == "2100-redux": - self.split = self._multitrack_paths["mix"][0].split(os.sep)[1] + self.split = os.path.normpath(self._multitrack_paths["mix"][0]).split(os.sep)[1] assert self.split in SPLITS, "{} not in SPLITS".format(self.split) self.data_split = self.split # deprecated in 0.3.6 From 0b9d5bdb7bd6d1f75f08c16e5dc485d55a67f1a4 Mon Sep 17 00:00:00 2001 From: Harsh Palan Date: Tue, 22 Nov 2022 17:16:02 -0500 Subject: [PATCH 4/5] updating issue with encoding and file formating --- mirdata/core.py | 2 +- .../datasets/compmusic_jingju_acappella.py | 7 +- mirdata/datasets/compmusic_otmm_makam.py | 9 +- mirdata/datasets/rwc_jazz.py | 3 +- mirdata/datasets/saraga_carnatic.py | 1 - mirdata/datasets/saraga_hindustani.py | 6 +- mirdata/datasets/slakh.py | 8 +- mirdata/io.py | 2 +- tests/datasets/test_acousticbrainz_genre.py | 20 +++- tests/datasets/test_beatles.py | 30 +++-- tests/datasets/test_beatport_key.py | 15 ++- tests/datasets/test_cante100.py | 20 +++- tests/datasets/test_compmusic_raga.py | 58 +++++---- tests/datasets/test_da_tacos.py | 35 ++++-- tests/datasets/test_dagstuhl_choirset.py | 80 ++++++++++--- tests/datasets/test_dali.py | 13 +- tests/datasets/test_filosax.py | 25 +++- tests/datasets/test_four_way_tabla.py | 25 +++- tests/datasets/test_freesound_one_shot.py | 20 +++- tests/datasets/test_giantsteps_key.py | 15 ++- tests/datasets/test_giantsteps_tempo.py | 17 ++- tests/datasets/test_good_sounds.py | 15 ++- tests/datasets/test_gtzan_genre.py | 18 ++- tests/datasets/test_guitarset.py | 30 +++-- tests/datasets/test_haydn_op20.py | 15 +-- tests/datasets/test_ikala.py | 21 +++- tests/datasets/test_irmas.py | 24 ++-- tests/datasets/test_jingju_acappella.py | 53 +++++++-- tests/datasets/test_medley_solos_db.py | 6 +- tests/datasets/test_medleydb_melody.py | 24 ++-- tests/datasets/test_medleydb_pitch.py | 18 ++- tests/datasets/test_mridangam_stroke.py | 6 +- .../test_mtg_jamendo_autotagging_moodtheme.py | 11 +- tests/datasets/test_openmic2018.py | 10 +- tests/datasets/test_orchset.py | 18 ++- tests/datasets/test_otmm_makam.py | 16 ++- tests/datasets/test_phenicx_anechoic.py | 36 ++++-- tests/datasets/test_queen.py | 23 ++-- tests/datasets/test_rwc_classical.py | 18 ++- tests/datasets/test_rwc_jazz.py | 20 ++-- tests/datasets/test_rwc_popular.py | 30 +++-- tests/datasets/test_salami.py | 28 +++-- tests/datasets/test_saraga_carnatic.py | 112 +++++++++++------- tests/datasets/test_saraga_hindustani.py | 48 +++++--- tests/datasets/test_slakh.py | 45 +++++-- tests/datasets/test_tinysol.py | 6 +- tests/datasets/test_tonality_classicaldb.py | 25 +++- tests/datasets/test_tonas.py | 15 ++- tests/datasets/test_vocadito.py | 25 +++- tests/test_core.py | 23 +++- tests/test_loaders.py | 4 +- tests/test_utils.py | 7 +- 52 files changed, 818 insertions(+), 343 deletions(-) diff --git a/mirdata/core.py b/mirdata/core.py index 419561f65..0ab0bd0d5 100644 --- a/mirdata/core.py +++ b/mirdata/core.py @@ -163,7 +163,7 @@ def __repr__(self): @cached_property def _index(self): try: - with open(self.index_path) as fhandle: + with open(self.index_path, encoding="utf-8") as fhandle: index = json.load(fhandle) except FileNotFoundError: if self._index_data.remote: diff --git a/mirdata/datasets/compmusic_jingju_acappella.py b/mirdata/datasets/compmusic_jingju_acappella.py index 5a1fec990..b42fd7cb1 100644 --- a/mirdata/datasets/compmusic_jingju_acappella.py +++ b/mirdata/datasets/compmusic_jingju_acappella.py @@ -281,7 +281,7 @@ def load_phrases(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] lyrics = [] - fhandle.reconfigure(encoding="utf-8") + # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) @@ -308,7 +308,7 @@ def load_syllable(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] events = [] - fhandle.reconfigure(encoding="utf-8") + # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) @@ -351,8 +351,7 @@ def _metadata(self): metadata = {} try: - with open(metadata_path_laosheng, "r") as fhandle: - fhandle.reconfigure(encoding='utf-8') + with open(metadata_path_laosheng, "r", encoding="utf-8") as fhandle: reader = csv.reader(fhandle, delimiter=",") next(reader) for line in reader: diff --git a/mirdata/datasets/compmusic_otmm_makam.py b/mirdata/datasets/compmusic_otmm_makam.py index 20237e69a..26ecacee0 100644 --- a/mirdata/datasets/compmusic_otmm_makam.py +++ b/mirdata/datasets/compmusic_otmm_makam.py @@ -189,7 +189,6 @@ def load_mb_tags(fhandle: TextIO) -> dict: Dict: metadata of the track """ - fhandle.reconfigure(encoding="utf-8") return json.load(fhandle) @@ -222,7 +221,7 @@ def _metadata(self): metadata = {} try: with open(metadata_path) as f: - f.reconfigure(encoding="utf-8") + # f.reconfigure(encoding="utf-8") meta = json.load(f) for i in meta: index = i["mbid"].split("/")[-1] @@ -233,11 +232,9 @@ def _metadata(self): } except FileNotFoundError: raise FileNotFoundError("Metadata not found. Did you run .download()?") - + temp = os.path.split(metadata_path)[-2] - # temp = metadata_path.split("/")[-2] - # data_home = metadata_path.split(temp)[0] - data_home = os.path.split(metadata_path)[0] + data_home = os.path.split(temp)[0] metadata["data_home"] = data_home return metadata diff --git a/mirdata/datasets/rwc_jazz.py b/mirdata/datasets/rwc_jazz.py index 9b968009c..ec7f695ea 100644 --- a/mirdata/datasets/rwc_jazz.py +++ b/mirdata/datasets/rwc_jazz.py @@ -244,8 +244,7 @@ def _metadata(self): metadata_path = os.path.join(self.data_home, "metadata-master", "rwc-j.csv") try: - with open(metadata_path, "r") as fhandle: - fhandle.reconfigure(encoding="utf-8") + with open(metadata_path, "r", encoding="utf-8") as fhandle: dialect = csv.Sniffer().sniff(fhandle.read(1024)) fhandle.seek(0) reader = csv.reader(fhandle, dialect) diff --git a/mirdata/datasets/saraga_carnatic.py b/mirdata/datasets/saraga_carnatic.py index 0a229fa49..4232b829a 100644 --- a/mirdata/datasets/saraga_carnatic.py +++ b/mirdata/datasets/saraga_carnatic.py @@ -398,7 +398,6 @@ def load_sections(fhandle): """ intervals = [] section_labels = [] - fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: if line != "\n": diff --git a/mirdata/datasets/saraga_hindustani.py b/mirdata/datasets/saraga_hindustani.py index aae2e2e68..bae166e01 100644 --- a/mirdata/datasets/saraga_hindustani.py +++ b/mirdata/datasets/saraga_hindustani.py @@ -288,15 +288,13 @@ def load_tempo(fhandle): """ tempo_annotation = {} - fhandle.reconfigure(encoding="utf-8") head, tail = os.path.split(fhandle.name) sections_path = tail.split(".")[0] + ".sections-manual-p.txt" sections_abs_path = os.path.join(head, sections_path) sections = [] try: - with open(sections_abs_path, "r") as fhandle2: - fhandle2.reconfigure(encoding="utf-8") + with open(sections_abs_path, "r", encoding="utf-8") as fhandle2: reader = csv.reader(fhandle2, delimiter=",") for line in reader: if line != "\n": @@ -381,7 +379,7 @@ def load_sections(fhandle): """ intervals = [] section_labels = [] - fhandle.reconfigure(encoding="utf-8") + # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter=",") for line in reader: if line: diff --git a/mirdata/datasets/slakh.py b/mirdata/datasets/slakh.py index 8221b0a62..db2781a8c 100644 --- a/mirdata/datasets/slakh.py +++ b/mirdata/datasets/slakh.py @@ -138,7 +138,9 @@ def __init__(self, track_id, data_home, dataset_name, index, metadata): # split (train/validation/test/omitted) is part of the relative filepath in the index self.split = None # for baby_slakh, there are no data splits - set to None if index["version"] == "2100-redux": - self.split = os.path.normpath(self._track_paths["metadata"][0]).split(os.sep)[1] + self.split = os.path.normpath(self._track_paths["metadata"][0]).split( + os.sep + )[1] assert ( self.split in SPLITS ), "{} not a valid split - should be one of {}.".format(self.split, SPLITS) @@ -266,7 +268,9 @@ def __init__( # split (train/validation/test) is determined by the relative filepath in the index self.split = None # for baby_slakh, there are no data splits - set to None if index["version"] == "2100-redux": - self.split = os.path.normpath(self._multitrack_paths["mix"][0]).split(os.sep)[1] + self.split = os.path.normpath(self._multitrack_paths["mix"][0]).split( + os.sep + )[1] assert self.split in SPLITS, "{} not in SPLITS".format(self.split) self.data_split = self.split # deprecated in 0.3.6 diff --git a/mirdata/io.py b/mirdata/io.py index 9e8ba6725..98425a4d9 100644 --- a/mirdata/io.py +++ b/mirdata/io.py @@ -19,7 +19,7 @@ def wrapper(file_path_or_obj: Optional[Union[str, TextIO]]) -> Optional[T]: if not file_path_or_obj: return None if isinstance(file_path_or_obj, str): - with open(file_path_or_obj) as f: + with open(file_path_or_obj, encoding="utf-8") as f: return func(f) elif isinstance(file_path_or_obj, io.StringIO): return func(file_path_or_obj) diff --git a/tests/datasets/test_acousticbrainz_genre.py b/tests/datasets/test_acousticbrainz_genre.py index a508598ef..dd413718b 100644 --- a/tests/datasets/test_acousticbrainz_genre.py +++ b/tests/datasets/test_acousticbrainz_genre.py @@ -14,7 +14,9 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "path": os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json"), + "path": os.path.normpath( + "tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json" + ), "track_id": "tagtraum#validation#be9e01e5-8f93-494d-bbaa-ddcc5a52f629#2b6bfcfd-46a5-3f98-a58f-2c51d7c9e960#trance########", "genre": ["trance"], "mbid": "be9e01e5-8f93-494d-bbaa-ddcc5a52f629", @@ -39,7 +41,9 @@ def test_track(): def test_load_extractor(): - path = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json") + path = os.path.normpath( + "tests/resources/mir_datasets/acousticbrainz_genre/acousticbrainz-mediaeval-validation/be/be9e01e5-8f93-494d-bbaa-ddcc5a52f629.json" + ) extractor_data = acousticbrainz_genre.load_extractor(path) assert isinstance(extractor_data, dict) @@ -81,14 +85,18 @@ def test_filter_index(): def test_download(httpserver): - data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre_download") + data_home = os.path.normpath( + "tests/resources/mir_datasets/acousticbrainz_genre_download" + ) if os.path.exists(data_home): shutil.rmtree(data_home) httpserver.serve_content( open( - os.path.normpath("tests/resources/download/acousticbrainz_genre_index.json.zip"), + os.path.normpath( + "tests/resources/download/acousticbrainz_genre_index.json.zip" + ), "rb", ).read() ) @@ -112,7 +120,9 @@ def test_download(httpserver): httpserver.serve_content( open( - os.path.normpath("tests/resources/download/acousticbrainz-mediaeval-features-train-01.tar.bz2"), + os.path.normpath( + "tests/resources/download/acousticbrainz-mediaeval-features-train-01.tar.bz2" + ), "rb", ).read() ) diff --git a/tests/datasets/test_beatles.py b/tests/datasets/test_beatles.py index 0b6f55602..a5f15b0fd 100644 --- a/tests/datasets/test_beatles.py +++ b/tests/datasets/test_beatles.py @@ -13,16 +13,26 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") - , "audio/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.wav"), - "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") - , "annotations/beat/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.txt"), - "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") - , "annotations/chordlab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), - "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") - , "annotations/keylab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatles/") - , "annotations/seglab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatles/"), + "audio/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.wav", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatles/"), + "annotations/beat/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.txt", + ), + "chords_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatles/"), + "annotations/chordlab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", + ), + "keys_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatles/"), + "annotations/keylab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatles/"), + "annotations/seglab/The Beatles/01_-_Please_Please_Me/11_-_Do_You_Want_To_Know_A_Secret.lab", + ), "title": "11_-_Do_You_Want_To_Know_A_Secret", "track_id": "0111", } diff --git a/tests/datasets/test_beatport_key.py b/tests/datasets/test_beatport_key.py index d3c01a75c..aea1169bf 100644 --- a/tests/datasets/test_beatport_key.py +++ b/tests/datasets/test_beatport_key.py @@ -12,9 +12,18 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"audio/100066 Lindstrom - Monsteer (Original Mix).mp3"), - "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"keys/100066 Lindstrom - Monsteer (Original Mix).txt"), - "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/beatport_key/"),"meta/100066 Lindstrom - Monsteer (Original Mix).json"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatport_key/"), + "audio/100066 Lindstrom - Monsteer (Original Mix).mp3", + ), + "keys_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatport_key/"), + "keys/100066 Lindstrom - Monsteer (Original Mix).txt", + ), + "metadata_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/beatport_key/"), + "meta/100066 Lindstrom - Monsteer (Original Mix).json", + ), "title": "100066 Lindstrom - Monsteer (Original Mix)", "track_id": "1", } diff --git a/tests/datasets/test_cante100.py b/tests/datasets/test_cante100.py index bd9df8478..ca2fc16d6 100644 --- a/tests/datasets/test_cante100.py +++ b/tests/datasets/test_cante100.py @@ -18,12 +18,24 @@ def test_track(): expected_attributes = { "artist": "Toronjo", "duration": 179.0, - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"), "cante100audio/008_PacoToronjo_Fandangos.mp3"), - "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100midi_f0/008_PacoToronjo_Fandangos.f0.csv"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/cante100/"), + "cante100audio/008_PacoToronjo_Fandangos.mp3", + ), + "f0_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/cante100/"), + "cante100midi_f0/008_PacoToronjo_Fandangos.f0.csv", + ), "identifier": "4eebe839-82bb-426e-914d-7c4525dd9dad", - "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100_automaticTranscription/008_PacoToronjo_Fandangos.notes.csv"), + "notes_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/cante100/"), + "cante100_automaticTranscription/008_PacoToronjo_Fandangos.notes.csv", + ), "release": "Atlas del cante flamenco", - "spectrogram_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/cante100/"),"cante100_spectrum/008_PacoToronjo_Fandangos.spectrum.csv"), + "spectrogram_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/cante100/"), + "cante100_spectrum/008_PacoToronjo_Fandangos.spectrum.csv", + ), "title": "Huelva Como Capital", "track_id": "008", } diff --git a/tests/datasets/test_compmusic_raga.py b/tests/datasets/test_compmusic_raga.py index f3e6a1a60..114bd68eb 100644 --- a/tests/datasets/test_compmusic_raga.py +++ b/tests/datasets/test_compmusic_raga.py @@ -8,33 +8,47 @@ def test_track(): default_trackid = "Aruna_Sairam.Valli_Kanavan" - data_home = "tests/resources/mir_datasets/compmusic_raga" + data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_raga") dataset = compmusic_raga.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "Aruna_Sairam.Valli_Kanavan", - "audio_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "audio/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.mp3", - "tonic_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.tonic", - "tonic_fine_tuned_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.tonicFine", - "pitch_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.pitch", - "pitch_post_processed_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.pitchSilIntrpPP", - "nyas_segments_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.flatSegNyas", - "tani_segments_path": "tests/resources/mir_datasets/compmusic_raga/RagaDataset/Carnatic/" - + "features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/" - + "Valli_Kanavan.taniSegKNN", + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/audio/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.mp3", + ), + "tonic_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.tonic", + ), + "tonic_fine_tuned_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.tonicFine", + ), + "pitch_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.pitch", + ), + "pitch_post_processed_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.pitchSilIntrpPP", + ), + "nyas_segments_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.flatSegNyas", + ), + "tani_segments_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_raga/"), + "RagaDataset/Carnatic/features/3af5a361-923a-465d-864d-9c7ba0c04a47/Aruna_Sairam/December_Season_2001/Valli_Kanavan/", + "Valli_Kanavan.taniSegKNN", + ), } expected_property_types = { diff --git a/tests/datasets/test_da_tacos.py b/tests/datasets/test_da_tacos.py index ac110dff8..1a66f07af 100644 --- a/tests/datasets/test_da_tacos.py +++ b/tests/datasets/test_da_tacos.py @@ -14,13 +14,34 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "cens_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_cens/W_163992_cens/P_547131_cens.h5"), - "crema_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_crema/W_163992_crema/P_547131_crema.h5"), - "hpcp_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_hpcp/W_163992_hpcp/P_547131_hpcp.h5"), - "key_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_key/W_163992_key/P_547131_key.h5"), - "madmom_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_madmom/W_163992_madmom/P_547131_madmom.h5"), - "mfcc_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_mfcc/W_163992_mfcc/P_547131_mfcc.h5"), - "tags_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/da_tacos/"),"da-tacos_coveranalysis_subset_tags/W_163992_tags/P_547131_tags.h5"), + "cens_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_cens/W_163992_cens/P_547131_cens.h5", + ), + "crema_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_crema/W_163992_crema/P_547131_crema.h5", + ), + "hpcp_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_hpcp/W_163992_hpcp/P_547131_hpcp.h5", + ), + "key_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_key/W_163992_key/P_547131_key.h5", + ), + "madmom_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_madmom/W_163992_madmom/P_547131_madmom.h5", + ), + "mfcc_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_mfcc/W_163992_mfcc/P_547131_mfcc.h5", + ), + "tags_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/da_tacos/"), + "da-tacos_coveranalysis_subset_tags/W_163992_tags/P_547131_tags.h5", + ), "track_id": "coveranalysis#W_163992#P_547131", "performance_id": "P_547131", "subset": "coveranalysis", diff --git a/tests/datasets/test_dagstuhl_choirset.py b/tests/datasets/test_dagstuhl_choirset.py index 9d57ff358..4dde349fb 100644 --- a/tests/datasets/test_dagstuhl_choirset.py +++ b/tests/datasets/test_dagstuhl_choirset.py @@ -15,17 +15,50 @@ def test_track(): expected_attributes = { "track_id": "DCS_LI_QuartetB_Take04_B2", - "audio_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_DYN.wav"), - "audio_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_HSM.wav"), - "audio_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_LRX.wav"), - "f0_crepe_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_DYN.csv"), - "f0_crepe_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_HSM.csv"), - "f0_crepe_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_LRX.csv"), - "f0_pyin_dyn_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_DYN.csv"), - "f0_pyin_hsm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_HSM.csv"), - "f0_pyin_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_LRX.csv"), - "f0_manual_lrx_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_F0_manual/DCS_LI_QuartetB_Take04_B2_LRX.csv"), - "score_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_scorerepresentation/DCS_LI_QuartetB_Take04_Stereo_STM_B.csv"), + "audio_dyn_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_DYN.wav", + ), + "audio_hsm_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_HSM.wav", + ), + "audio_lrx_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_B2_LRX.wav", + ), + "f0_crepe_dyn_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_DYN.csv", + ), + "f0_crepe_hsm_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_HSM.csv", + ), + "f0_crepe_lrx_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_CREPE/DCS_LI_QuartetB_Take04_B2_LRX.csv", + ), + "f0_pyin_dyn_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_DYN.csv", + ), + "f0_pyin_hsm_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_HSM.csv", + ), + "f0_pyin_lrx_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_PYIN/DCS_LI_QuartetB_Take04_B2_LRX.csv", + ), + "f0_manual_lrx_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_F0_manual/DCS_LI_QuartetB_Take04_B2_LRX.csv", + ), + "score_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_scorerepresentation/DCS_LI_QuartetB_Take04_Stereo_STM_B.csv", + ), } expected_property_types = { @@ -228,13 +261,28 @@ def test_multitrack(): expected_attributes = { "mtrack_id": "DCS_LI_QuartetB_Take04", - "audio_stm_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STM.wav"), - "audio_str_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STR.wav"), - "audio_stl_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STL.wav"), - "audio_rev_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"audio_wav_22050_mono/DCS_LI_QuartetB_Take04_StereoReverb_STM.wav"), + "audio_stm_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STM.wav", + ), + "audio_str_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STR.wav", + ), + "audio_stl_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_Stereo_STL.wav", + ), + "audio_rev_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "audio_wav_22050_mono/DCS_LI_QuartetB_Take04_StereoReverb_STM.wav", + ), "audio_spl_path": None, "audio_spr_path": None, - "beat_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"),"annotations_csv_beat/DCS_LI_QuartetB_Take04_Stereo_STM.csv"), + "beat_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dagstuhl_choirset/"), + "annotations_csv_beat/DCS_LI_QuartetB_Take04_Stereo_STM.csv", + ), "track_ids": [ "DCS_LI_QuartetB_Take04_A2", "DCS_LI_QuartetB_Take04_B2", diff --git a/tests/datasets/test_dali.py b/tests/datasets/test_dali.py index 4fcf363ba..3c306b02e 100644 --- a/tests/datasets/test_dali.py +++ b/tests/datasets/test_dali.py @@ -15,6 +15,7 @@ from tests.test_utils import run_track_tests import numpy as np + def test_track(): default_trackid = "4b196e6c99574dd49ad00d56e132712b" @@ -24,11 +25,15 @@ def test_track(): expected_attributes = { "album": "Mezmerize", - "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dali/") - , "annotations/4b196e6c99574dd49ad00d56e132712b.gz"), + "annotation_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dali/"), + "annotations/4b196e6c99574dd49ad00d56e132712b.gz", + ), "artist": "System Of A Down", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/dali/") - , "audio/4b196e6c99574dd49ad00d56e132712b.mp3"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/dali/"), + "audio/4b196e6c99574dd49ad00d56e132712b.mp3", + ), "audio_url": "zUzd9KyIDrM", "dataset_version": 1, "genres": ["Pop", "Rock", "Hard Rock", "Metal"], diff --git a/tests/datasets/test_filosax.py b/tests/datasets/test_filosax.py index dd532c568..a6b40415f 100644 --- a/tests/datasets/test_filosax.py +++ b/tests/datasets/test_filosax.py @@ -20,11 +20,26 @@ def test_track(): expected_attributes = { "track_id": "multitrack_02_sax_1", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.wav"), - "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/annotations.json"), - "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.mid"), - "musicXML_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.musicxml"), - "pdf_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/filosax/"),"Participant 1/02/Sax.pdf"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/filosax/"), + "Participant 1/02/Sax.wav", + ), + "annotation_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/filosax/"), + "Participant 1/02/annotations.json", + ), + "midi_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/filosax/"), + "Participant 1/02/Sax.mid", + ), + "musicXML_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/filosax/"), + "Participant 1/02/Sax.musicxml", + ), + "pdf_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/filosax/"), + "Participant 1/02/Sax.pdf", + ), } expected_property_types = { diff --git a/tests/datasets/test_four_way_tabla.py b/tests/datasets/test_four_way_tabla.py index 2560d7040..343e818d3 100644 --- a/tests/datasets/test_four_way_tabla.py +++ b/tests/datasets/test_four_way_tabla.py @@ -13,11 +13,26 @@ def test_track(): dataset = four_way_tabla.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/audios/AHK_solo-tintal-1.wav"), - "onsets_b_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/b/AHK_solo-tintal-1.onsets"), - "onsets_d_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/d/AHK_solo-tintal-1.onsets"), - "onsets_rb_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/rb/AHK_solo-tintal-1.onsets"), - "onsets_rt_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"),"4way-tabla-ismir21-dataset/train/onsets/rt/AHK_solo-tintal-1.onsets"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"), + "4way-tabla-ismir21-dataset/train/audios/AHK_solo-tintal-1.wav", + ), + "onsets_b_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"), + "4way-tabla-ismir21-dataset/train/onsets/b/AHK_solo-tintal-1.onsets", + ), + "onsets_d_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"), + "4way-tabla-ismir21-dataset/train/onsets/d/AHK_solo-tintal-1.onsets", + ), + "onsets_rb_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"), + "4way-tabla-ismir21-dataset/train/onsets/rb/AHK_solo-tintal-1.onsets", + ), + "onsets_rt_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/four_way_tabla/"), + "4way-tabla-ismir21-dataset/train/onsets/rt/AHK_solo-tintal-1.onsets", + ), "track_id": "AHK_solo-tintal-1", "train": True, } diff --git a/tests/datasets/test_freesound_one_shot.py b/tests/datasets/test_freesound_one_shot.py index 6aadaf4a9..1731b56c1 100644 --- a/tests/datasets/test_freesound_one_shot.py +++ b/tests/datasets/test_freesound_one_shot.py @@ -4,7 +4,9 @@ from tests.test_utils import run_track_tests from mirdata.datasets import freesound_one_shot_percussive_sounds -TEST_DATA_HOME = os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds") +TEST_DATA_HOME = os.path.normpath( + "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds" +) def test_track(): @@ -13,10 +15,18 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/") - , "one_shot_percussive_sounds/1/183.wav"), - "file_metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/") - , "analysis/1/183_analysis.json"), + "audio_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/" + ), + "one_shot_percussive_sounds/1/183.wav", + ), + "file_metadata_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/freesound_one_shot_percussive_sounds/" + ), + "analysis/1/183_analysis.json", + ), "track_id": "183", } diff --git a/tests/datasets/test_giantsteps_key.py b/tests/datasets/test_giantsteps_key.py index fb521bb22..e45021e96 100644 --- a/tests/datasets/test_giantsteps_key.py +++ b/tests/datasets/test_giantsteps_key.py @@ -12,9 +12,18 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"audio/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).mp3"), - "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"keys_gs+/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).txt"), - "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"),"meta/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).json"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"), + "audio/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).mp3", + ), + "keys_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"), + "keys_gs+/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).txt", + ), + "metadata_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_key/"), + "meta/10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix).json", + ), "title": "10089 Jason Sparks - Close My Eyes feat. J. Little (Original Mix)", "track_id": "3", } diff --git a/tests/datasets/test_giantsteps_tempo.py b/tests/datasets/test_giantsteps_tempo.py index 9840d300e..35d4a9d32 100644 --- a/tests/datasets/test_giantsteps_tempo.py +++ b/tests/datasets/test_giantsteps_tempo.py @@ -13,11 +13,18 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/"),"audio/28952.LOFI.mp3"), - "annotation_v1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/") - ,"giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations/jams/28952.LOFI.jams"), - "annotation_v2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/") - ,"giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations_v2/jams/28952.LOFI.jams"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/"), + "audio/28952.LOFI.mp3", + ), + "annotation_v1_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/"), + "giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations/jams/28952.LOFI.jams", + ), + "annotation_v2_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/giantsteps_tempo/"), + "giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb/annotations_v2/jams/28952.LOFI.jams", + ), "title": "28952", "track_id": "113", } diff --git a/tests/datasets/test_good_sounds.py b/tests/datasets/test_good_sounds.py index 9898b2b4c..0753e791d 100644 --- a/tests/datasets/test_good_sounds.py +++ b/tests/datasets/test_good_sounds.py @@ -12,7 +12,10 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/good_sounds/"), + "good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + ), "track_id": "1", } @@ -73,7 +76,10 @@ def test_track_properties_and_attributes(): ground_truth_take = { "id": 1, "microphone": "akg", - "filename": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), + "filename": os.path.join( + os.path.normpath("tests/resources/mir_datasets/good_sounds/"), + "good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + ), "original_filename": "AKG-costado-Left-01 render 001", "freesound_id": None, "sound_id": 1, @@ -133,7 +139,10 @@ def test_to_jams(): ground_truth_take = { "id": 1, "microphone": "akg", - "filename": os.path.join(os.path.normpath("tests/resources/mir_datasets/good_sounds/"),"good-sounds/sound_files/flute_almudena_reference/akg/0000.wav"), + "filename": os.path.join( + os.path.normpath("tests/resources/mir_datasets/good_sounds/"), + "good-sounds/sound_files/flute_almudena_reference/akg/0000.wav", + ), "original_filename": "AKG-costado-Left-01 render 001", "freesound_id": None, "sound_id": 1, diff --git a/tests/datasets/test_gtzan_genre.py b/tests/datasets/test_gtzan_genre.py index 1b4343d22..86db247fa 100644 --- a/tests/datasets/test_gtzan_genre.py +++ b/tests/datasets/test_gtzan_genre.py @@ -13,12 +13,18 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { "genre": "country", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") - , "gtzan_genre/genres/country/country.00000.wav"), - "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") - , "gtzan_tempo_beat-main/beats/gtzan_country_00000.beats"), - "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/gtzan_genre/") - , "gtzan_tempo_beat-main/tempo/gtzan_country_00000.bpm"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/gtzan_genre/"), + "gtzan_genre/genres/country/country.00000.wav", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/gtzan_genre/"), + "gtzan_tempo_beat-main/beats/gtzan_country_00000.beats", + ), + "tempo_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/gtzan_genre/"), + "gtzan_tempo_beat-main/tempo/gtzan_country_00000.bpm", + ), "track_id": "country.00000", } expected_properties = { diff --git a/tests/datasets/test_guitarset.py b/tests/datasets/test_guitarset.py index c38345f3a..551b46a2f 100644 --- a/tests/datasets/test_guitarset.py +++ b/tests/datasets/test_guitarset.py @@ -16,16 +16,26 @@ def test_track(): expected_attributes = { "track_id": "03_BN3-119-G_solo", - "audio_hex_cln_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") - , "audio_hex-pickup_debleeded/03_BN3-119-G_solo_hex_cln.wav"), - "audio_hex_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") - , "audio_hex-pickup_original/03_BN3-119-G_solo_hex.wav"), - "audio_mic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") - , "audio_mono-mic/03_BN3-119-G_solo_mic.wav"), - "audio_mix_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") - , "audio_mono-pickup_mix/03_BN3-119-G_solo_mix.wav"), - "jams_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/guitarset/") - , "annotation/03_BN3-119-G_solo.jams"), + "audio_hex_cln_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/guitarset/"), + "audio_hex-pickup_debleeded/03_BN3-119-G_solo_hex_cln.wav", + ), + "audio_hex_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/guitarset/"), + "audio_hex-pickup_original/03_BN3-119-G_solo_hex.wav", + ), + "audio_mic_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/guitarset/"), + "audio_mono-mic/03_BN3-119-G_solo_mic.wav", + ), + "audio_mix_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/guitarset/"), + "audio_mono-pickup_mix/03_BN3-119-G_solo_mix.wav", + ), + "jams_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/guitarset/"), + "annotation/03_BN3-119-G_solo.jams", + ), "player_id": "03", "tempo": 119, "mode": "solo", diff --git a/tests/datasets/test_haydn_op20.py b/tests/datasets/test_haydn_op20.py index dabfb367e..d4cf64da3 100644 --- a/tests/datasets/test_haydn_op20.py +++ b/tests/datasets/test_haydn_op20.py @@ -24,7 +24,10 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "humdrum_annotated_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.hrm"), + "humdrum_annotated_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/haydn_op20/"), + "op20n1-01.hrm", + ), "title": "op20n1-01", "track_id": "0", } @@ -49,13 +52,11 @@ def test_to_jam(): jam = track.to_jams() assert jam["file_metadata"]["title"] == "op20n1-01", "title does not match expected" assert jam["file_metadata"]["duration"] == 644, "duration does not match expected" - assert ( - jam["sandbox"]["humdrum_annotated_path"] - == os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.hrm") + assert jam["sandbox"]["humdrum_annotated_path"] == os.path.join( + os.path.normpath("tests/resources/mir_datasets/haydn_op20/"), "op20n1-01.hrm" ), "duration does not match expected" - assert ( - jam["sandbox"]["midi_path"] - == os.path.join(os.path.normpath("tests/resources/mir_datasets/haydn_op20/"),"op20n1-01.midi") + assert jam["sandbox"]["midi_path"] == os.path.join( + os.path.normpath("tests/resources/mir_datasets/haydn_op20/"), "op20n1-01.midi" ), "duration does not match expected" assert isinstance(jam["sandbox"]["chords_music21"], list) assert jam["sandbox"]["chords_music21"][0]["time"] == 0 diff --git a/tests/datasets/test_ikala.py b/tests/datasets/test_ikala.py index 73c5099bb..e296a783d 100644 --- a/tests/datasets/test_ikala.py +++ b/tests/datasets/test_ikala.py @@ -14,14 +14,25 @@ def test_track(): expected_attributes = { "track_id": "10161_chorus", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/") - , "Wavfile/10161_chorus.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/ikala/"), + "Wavfile/10161_chorus.wav", + ), "song_id": "10161", "section": "chorus", "singer_id": "1", - "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"PitchLabel/10161_chorus.pv"), - "lyrics_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"Lyrics/10161_chorus.lab"), - "notes_pyin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/ikala/"),"ikala-pyin-notes/10161_chorus_vamp_pyin_pyin_notes.csv"), + "f0_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/ikala/"), + "PitchLabel/10161_chorus.pv", + ), + "lyrics_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/ikala/"), + "Lyrics/10161_chorus.lab", + ), + "notes_pyin_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/ikala/"), + "ikala-pyin-notes/10161_chorus_vamp_pyin_pyin_notes.csv", + ), } expected_property_types = { diff --git a/tests/datasets/test_irmas.py b/tests/datasets/test_irmas.py index f628007ac..55cc67775 100644 --- a/tests/datasets/test_irmas.py +++ b/tests/datasets/test_irmas.py @@ -12,10 +12,14 @@ def test_track(): track = dataset.track(default_trackid) track_train = dataset.track(default_trackid_train) expected_attributes = { - "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") - , "IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.txt"), - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") - ,"IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.wav"), + "annotation_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/irmas/"), + "IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.txt", + ), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/irmas/"), + "IRMAS-TestingData-Part1/Part1/02 - And The Body Will Die-8.wav", + ), "track_id": "1", "predominant_instrument": None, "genre": None, @@ -24,10 +28,14 @@ def test_track(): "train": False, } expected_attributes_train = { - "annotation_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") - ,"IRMAS-TrainingData/cla/[cla][cla]0189__2.wav"), - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/irmas/") - ,"IRMAS-TrainingData/cla/[cla][cla]0189__2.wav"), + "annotation_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/irmas/"), + "IRMAS-TrainingData/cla/[cla][cla]0189__2.wav", + ), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/irmas/"), + "IRMAS-TrainingData/cla/[cla][cla]0189__2.wav", + ), "track_id": "0189__2", "predominant_instrument": "cla", "genre": "cla", diff --git a/tests/datasets/test_jingju_acappella.py b/tests/datasets/test_jingju_acappella.py index ad85d525a..302e32925 100644 --- a/tests/datasets/test_jingju_acappella.py +++ b/tests/datasets/test_jingju_acappella.py @@ -4,8 +4,11 @@ from tests.test_utils import run_track_tests import os + def test_track(): - data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella") + data_home = os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella" + ) track_id = "lseh-Tan_Yang_jia-Hong_yang_dong-qm" dataset = compmusic_jingju_acappella.Dataset(data_home) @@ -13,19 +16,43 @@ def test_track(): expected_attributes = { "track_id": "lseh-Tan_Yang_jia-Hong_yang_dong-qm", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "wav/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.wav"), - "phrase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase.txt"), - "phrase_char_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase_char.txt"), - "phoneme_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phoneme.txt"), - "syllable_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_syllable.txt"), + "audio_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "wav/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.wav", + ), + "phrase_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase.txt", + ), + "phrase_char_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phrase_char.txt", + ), + "phoneme_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_phoneme.txt", + ), + "syllable_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "annotation_txt/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm_syllable.txt", + ), "title": "Türk Müziğinde 75 Büyük Bestekar/ 75 Great Composers In Turkish Classical Music", - "textgrid_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_jingju_acappella/") - , "textgrid/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.TextGrid"), + "textgrid_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_jingju_acappella/" + ), + "textgrid/laosheng/lseh-Tan_Yang_jia-Hong_yang_dong-qm.TextGrid", + ), "work": "“叹杨家投宋主心血用尽”——《洪羊洞》(杨延昭)", "details": None, } diff --git a/tests/datasets/test_medley_solos_db.py b/tests/datasets/test_medley_solos_db.py index 79026b8ac..c8154265c 100644 --- a/tests/datasets/test_medley_solos_db.py +++ b/tests/datasets/test_medley_solos_db.py @@ -11,8 +11,10 @@ def test_track(): expected_attributes = { "track_id": "d07b1fc0-567d-52c2-fef4-239f31c9d40e", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medley_solos_db/") - , "audio/Medley-solos-DB_validation-3_d07b1fc0-567d-52c2-fef4-239f31c9d40e.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medley_solos_db/"), + "audio/Medley-solos-DB_validation-3_d07b1fc0-567d-52c2-fef4-239f31c9d40e.wav", + ), "instrument": "flute", "instrument_id": 3, "song_id": 210, diff --git a/tests/datasets/test_medleydb_melody.py b/tests/datasets/test_medleydb_melody.py index 1fb66680f..72023ef30 100644 --- a/tests/datasets/test_medleydb_melody.py +++ b/tests/datasets/test_medleydb_melody.py @@ -14,14 +14,22 @@ def test_track(): expected_attributes = { "track_id": "MusicDelta_Beethoven", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") - , "audio/MusicDelta_Beethoven_MIX.wav"), - "melody1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") - , "melody1/MusicDelta_Beethoven_MELODY1.csv"), - "melody2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") - , "melody2/MusicDelta_Beethoven_MELODY2.csv"), - "melody3_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_melody/") - , "melody3/MusicDelta_Beethoven_MELODY3.csv"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_melody/"), + "audio/MusicDelta_Beethoven_MIX.wav", + ), + "melody1_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_melody/"), + "melody1/MusicDelta_Beethoven_MELODY1.csv", + ), + "melody2_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_melody/"), + "melody2/MusicDelta_Beethoven_MELODY2.csv", + ), + "melody3_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_melody/"), + "melody3/MusicDelta_Beethoven_MELODY3.csv", + ), "artist": "MusicDelta", "title": "Beethoven", "genre": "Classical", diff --git a/tests/datasets/test_medleydb_pitch.py b/tests/datasets/test_medleydb_pitch.py index b7b68c850..1fe19da71 100644 --- a/tests/datasets/test_medleydb_pitch.py +++ b/tests/datasets/test_medleydb_pitch.py @@ -14,12 +14,18 @@ def test_track(): expected_attributes = { "track_id": "AClassicEducation_NightOwl_STEM_08", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") - , "audio/AClassicEducation_NightOwl_STEM_08.wav"), - "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") - , "pitch/AClassicEducation_NightOwl_STEM_08.csv"), - "notes_pyin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/") - , "medleydb-pitch-pyin-notes/AClassicEducation_NightOwl_STEM_08_vamp_pyin_pyin_notes.csv"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/"), + "audio/AClassicEducation_NightOwl_STEM_08.wav", + ), + "pitch_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/"), + "pitch/AClassicEducation_NightOwl_STEM_08.csv", + ), + "notes_pyin_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/medleydb_pitch/"), + "medleydb-pitch-pyin-notes/AClassicEducation_NightOwl_STEM_08_vamp_pyin_pyin_notes.csv", + ), "instrument": "male singer", "artist": "AClassicEducation", "title": "NightOwl", diff --git a/tests/datasets/test_mridangam_stroke.py b/tests/datasets/test_mridangam_stroke.py index a4bff6cb3..4924c79aa 100644 --- a/tests/datasets/test_mridangam_stroke.py +++ b/tests/datasets/test_mridangam_stroke.py @@ -11,8 +11,10 @@ def test_track(): dataset = mridangam_stroke.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/mridangam_stroke/") - ,"mridangam_stroke_1.5/B/224030__akshaylaya__bheem-b-001.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/mridangam_stroke/"), + "mridangam_stroke_1.5/B/224030__akshaylaya__bheem-b-001.wav", + ), "track_id": "224030", "stroke_name": "bheem", "tonic": "B", diff --git a/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py b/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py index 0482535c4..732a04e14 100644 --- a/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py +++ b/tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py @@ -8,13 +8,20 @@ def test_track(): default_trackid = "track_0000948" - data_home = os.path.normpath("tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme") + data_home = os.path.normpath( + "tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme" + ) dataset = mtg_jamendo_autotagging_moodtheme.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "audio_path": ( - os.path.join(os.path.normpath("tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme/"),"audios/48/948.mp3") + os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme/" + ), + "audios/48/948.mp3", + ) ), "track_id": "track_0000948", } diff --git a/tests/datasets/test_openmic2018.py b/tests/datasets/test_openmic2018.py index c07357e31..c2885530e 100644 --- a/tests/datasets/test_openmic2018.py +++ b/tests/datasets/test_openmic2018.py @@ -14,8 +14,14 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/openmic2018/"),"audio/000/000046_3840.ogg"), - "vggish_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/openmic2018/"),"vggish/000/000046_3840.json"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/openmic2018/"), + "audio/000/000046_3840.ogg", + ), + "vggish_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/openmic2018/"), + "vggish/000/000046_3840.json", + ), "track_id": "000046_3840", "title": "Yosemite", "artist": "Nicky Cook", diff --git a/tests/datasets/test_orchset.py b/tests/datasets/test_orchset.py index 4696b4223..1b415cd50 100644 --- a/tests/datasets/test_orchset.py +++ b/tests/datasets/test_orchset.py @@ -15,12 +15,18 @@ def test_track(): expected_attributes = { "track_id": "Beethoven-S3-I-ex1", - "audio_path_mono": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") - , "audio/mono/Beethoven-S3-I-ex1.wav"), - "audio_path_stereo": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") - , "audio/stereo/Beethoven-S3-I-ex1.wav"), - "melody_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/orchset/") - , "GT/Beethoven-S3-I-ex1.mel"), + "audio_path_mono": os.path.join( + os.path.normpath("tests/resources/mir_datasets/orchset/"), + "audio/mono/Beethoven-S3-I-ex1.wav", + ), + "audio_path_stereo": os.path.join( + os.path.normpath("tests/resources/mir_datasets/orchset/"), + "audio/stereo/Beethoven-S3-I-ex1.wav", + ), + "melody_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/orchset/"), + "GT/Beethoven-S3-I-ex1.mel", + ), "composer": "Beethoven", "work": "S3-I", "excerpt": "1", diff --git a/tests/datasets/test_otmm_makam.py b/tests/datasets/test_otmm_makam.py index 9525caba6..ff3ec2380 100644 --- a/tests/datasets/test_otmm_makam.py +++ b/tests/datasets/test_otmm_makam.py @@ -14,10 +14,14 @@ def test_track(): expected_attributes = { "track_id": "cafcdeaf-e966-4ff0-84fb-f660d2b68365", - "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/") - , "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.pitch"), - "mb_tags_path":os.path.join(os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/") - , "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.json"), + "pitch_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/"), + "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.pitch", + ), + "mb_tags_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_otmm_makam/"), + "MTG-otmm_makam_recognition_dataset-f14c0d0/data/Kurdilihicazkar/cafcdeaf-e966-4ff0-84fb-f660d2b68365.json", + ), "form": "sarki", "instrumentation": "Solo vocal with accompaniment", "mb_url": "http://musicbrainz.org/work/cafcdeaf-e966-4ff0-84fb-f660d2b68365", @@ -490,7 +494,9 @@ def test_load_metadata(): assert metadata[track_id]["tonic"] == 260.0 assert metadata[track_id]["makam"] == "Kurdilihicazkar" assert metadata[track_id]["mbid"] == "cafcdeaf-e966-4ff0-84fb-f660d2b68365" - assert metadata["data_home"] == "tests/resources/mir_datasets/compmusic_otmm_makam/" + assert metadata["data_home"] == os.path.normpath( + "tests/resources/mir_datasets/compmusic_otmm_makam" + ) def test_load_mb_tags(): diff --git a/tests/datasets/test_phenicx_anechoic.py b/tests/datasets/test_phenicx_anechoic.py index e1ddeef86..9ba20ec14 100644 --- a/tests/datasets/test_phenicx_anechoic.py +++ b/tests/datasets/test_phenicx_anechoic.py @@ -17,19 +17,31 @@ def test_track(): expected_attributes = { "track_id": "beethoven-violin", "audio_paths": [ - os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "audio/beethoven/violin1.wav"), - os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "audio/beethoven/violin2.wav"), - os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "audio/beethoven/violin3.wav"), - os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "audio/beethoven/violin4.wav"), + os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "audio/beethoven/violin1.wav", + ), + os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "audio/beethoven/violin2.wav", + ), + os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "audio/beethoven/violin3.wav", + ), + os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "audio/beethoven/violin4.wav", + ), ], - "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "annotations/beethoven/violin.txt"), - "notes_original_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/") - , "annotations/beethoven/violin_o.txt"), + "notes_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "annotations/beethoven/violin.txt", + ), + "notes_original_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/phenicx_anechoic/"), + "annotations/beethoven/violin_o.txt", + ), "instrument": "violin", "piece": "beethoven", "n_voices": 4, diff --git a/tests/datasets/test_queen.py b/tests/datasets/test_queen.py index ad0e35888..684734f5d 100644 --- a/tests/datasets/test_queen.py +++ b/tests/datasets/test_queen.py @@ -13,13 +13,22 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/"),"audio/Greatest Hits I/01 Bohemian Rhapsody.flac"), - "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") - ,"annotations/chordlab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), - "keys_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") - , "annotations/keylab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/queen/") - , "annotations/seglab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/queen/"), + "audio/Greatest Hits I/01 Bohemian Rhapsody.flac", + ), + "chords_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/queen/"), + "annotations/chordlab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", + ), + "keys_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/queen/"), + "annotations/keylab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/queen/"), + "annotations/seglab/Queen/Greatest Hits I/01 Bohemian Rhapsody.lab", + ), "title": "01 Bohemian Rhapsody", "track_id": "0", } diff --git a/tests/datasets/test_rwc_classical.py b/tests/datasets/test_rwc_classical.py index 16219db09..8ba3937df 100644 --- a/tests/datasets/test_rwc_classical.py +++ b/tests/datasets/test_rwc_classical.py @@ -14,12 +14,18 @@ def test_track(): expected_attributes = { "track_id": "RM-C003", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") - , "audio/rwc-c-m01/3.wav"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") - , "annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C003.CHORUS.TXT"), - "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_classical/") - , "annotations/AIST.RWC-MDB-C-2001.BEAT/RM-C003.BEAT.TXT"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_classical/"), + "audio/rwc-c-m01/3.wav", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_classical/"), + "annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C003.CHORUS.TXT", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_classical/"), + "annotations/AIST.RWC-MDB-C-2001.BEAT/RM-C003.BEAT.TXT", + ), "piece_number": "No. 3", "suffix": "M01", "track_number": "Tr. 03", diff --git a/tests/datasets/test_rwc_jazz.py b/tests/datasets/test_rwc_jazz.py index da077d27f..c16f17a23 100644 --- a/tests/datasets/test_rwc_jazz.py +++ b/tests/datasets/test_rwc_jazz.py @@ -13,12 +13,18 @@ def test_track(): expected_attributes = { "track_id": "RM-J004", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") - , "audio/rwc-j-m01/4.wav"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") - , "annotations/AIST.RWC-MDB-J-2001.CHORUS/RM-J004.CHORUS.TXT"), - "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_jazz/") - , "annotations/AIST.RWC-MDB-J-2001.BEAT/RM-J004.BEAT.TXT"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_jazz/"), + "audio/rwc-j-m01/4.wav", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_jazz/"), + "annotations/AIST.RWC-MDB-J-2001.CHORUS/RM-J004.CHORUS.TXT", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_jazz/"), + "annotations/AIST.RWC-MDB-J-2001.BEAT/RM-J004.BEAT.TXT", + ), "piece_number": "No. 4", "suffix": "M01", "track_number": "Tr. 04", @@ -126,7 +132,7 @@ def test_load_metadata(): "suffix": "M04", "track_number": "Tr. 09", "title": "Joyful, Joyful, We Adore Thee", - "artist": (u"K’s Band"), + "artist": ("K’s Band"), "duration": 270, "variation": "Style (Free jazz)", "instruments": "Pf & Bs & Dr & Gt & Ts & Fl & Bar", diff --git a/tests/datasets/test_rwc_popular.py b/tests/datasets/test_rwc_popular.py index b327adf3e..cf7bceb98 100644 --- a/tests/datasets/test_rwc_popular.py +++ b/tests/datasets/test_rwc_popular.py @@ -15,16 +15,26 @@ def test_track(): expected_attributes = { "track_id": "RM-P001", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") - , "audio/rwc-p-m01/1.wav"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") - , "annotations/AIST.RWC-MDB-P-2001.CHORUS/RM-P001.CHORUS.TXT"), - "beats_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") - , "annotations/AIST.RWC-MDB-P-2001.BEAT/RM-P001.BEAT.TXT"), - "chords_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") - , "annotations/AIST.RWC-MDB-P-2001.CHORD/RWC_Pop_Chords/N001-M01-T01.lab"), - "voca_inst_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/rwc_popular/") - , "annotations/AIST.RWC-MDB-P-2001.VOCA_INST/RM-P001.VOCA_INST.TXT"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_popular/"), + "audio/rwc-p-m01/1.wav", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_popular/"), + "annotations/AIST.RWC-MDB-P-2001.CHORUS/RM-P001.CHORUS.TXT", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_popular/"), + "annotations/AIST.RWC-MDB-P-2001.BEAT/RM-P001.BEAT.TXT", + ), + "chords_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_popular/"), + "annotations/AIST.RWC-MDB-P-2001.CHORD/RWC_Pop_Chords/N001-M01-T01.lab", + ), + "voca_inst_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/rwc_popular/"), + "annotations/AIST.RWC-MDB-P-2001.VOCA_INST/RM-P001.VOCA_INST.TXT", + ), "piece_number": "No. 1", "suffix": "M01", "track_number": "Tr. 01", diff --git a/tests/datasets/test_salami.py b/tests/datasets/test_salami.py index 69532b016..1750b7de3 100644 --- a/tests/datasets/test_salami.py +++ b/tests/datasets/test_salami.py @@ -14,15 +14,25 @@ def test_track(): expected_attributes = { "track_id": "2", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/"), "audio/2.mp3"), - "sections_annotator1_uppercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") - , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_uppercase.txt"), - "sections_annotator1_lowercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") - , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_lowercase.txt"), - "sections_annotator2_uppercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") - , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_uppercase.txt"), - "sections_annotator2_lowercase_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/salami/") - , "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_lowercase.txt"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/salami/"), "audio/2.mp3" + ), + "sections_annotator1_uppercase_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/salami/"), + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_uppercase.txt", + ), + "sections_annotator1_lowercase_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/salami/"), + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile1_lowercase.txt", + ), + "sections_annotator2_uppercase_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/salami/"), + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_uppercase.txt", + ), + "sections_annotator2_lowercase_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/salami/"), + "salami-data-public-hierarchy-corrections/annotations/2/parsed/textfile2_lowercase.txt", + ), "source": "Codaich", "annotator_1_id": "5", "annotator_2_id": "8", diff --git a/tests/datasets/test_saraga_carnatic.py b/tests/datasets/test_saraga_carnatic.py index 17dacc00b..31e359880 100644 --- a/tests/datasets/test_saraga_carnatic.py +++ b/tests/datasets/test_saraga_carnatic.py @@ -13,49 +13,77 @@ def test_track(): expected_attributes = { "track_id": "116_Bhuvini_Dasudane", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.mp3.mp3"), - "audio_ghatam_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-ghatam.mp3"), - "audio_mridangam_left_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-left.mp3"), - "audio_mridangam_right_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-right.mp3"), - "audio_violin_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-violin.mp3"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.mp3.mp3", + ), + "audio_ghatam_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-ghatam.mp3", + ), + "audio_mridangam_left_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-left.mp3", + ), + "audio_mridangam_right_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-mridangam-right.mp3", + ), + "audio_violin_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-violin.mp3", + ), "audio_vocal_s_path": None, - "audio_vocal_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-vocal.mp3"), - "ctonic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.ctonic.txt"), - "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.pitch.txt"), - "pitch_vocal_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.pitch-vocal.txt"), - "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.tempo-manual.txt"), - "sama_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.sama-manual.txt"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.sections-manual-p.txt"), - "phrases_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.mphrases-manual.txt"), - "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/") - , "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/" - , "Bhuvini Dasudane/Bhuvini Dasudane.json"), + "audio_vocal_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.multitrack-vocal.mp3", + ), + "ctonic_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.ctonic.txt", + ), + "pitch_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.pitch.txt", + ), + "pitch_vocal_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.pitch-vocal.txt", + ), + "tempo_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.tempo-manual.txt", + ), + "sama_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.sama-manual.txt", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.sections-manual-p.txt", + ), + "phrases_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.mphrases-manual.txt", + ), + "metadata_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_carnatic/"), + "saraga1.5_carnatic/Cherthala Ranganatha Sharma at Arkay by Cherthala Ranganatha Sharma/", + "Bhuvini Dasudane/Bhuvini Dasudane.json", + ), } expected_property_types = { diff --git a/tests/datasets/test_saraga_hindustani.py b/tests/datasets/test_saraga_hindustani.py index de78ea238..41347cc32 100644 --- a/tests/datasets/test_saraga_hindustani.py +++ b/tests/datasets/test_saraga_hindustani.py @@ -15,22 +15,38 @@ def test_track(): expected_attributes = { "track_id": "50_Irani_Bhairavi_Thumri", "title": "Irani Bhairavi Thumri", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - ,"saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mp3.mp3"), - "ctonic_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.ctonic.txt"), - "pitch_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.pitch.txt"), - "tempo_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.tempo-manual.txt"), - "sama_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sama-manual.txt"), - "sections_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sections-manual-p.txt"), - "phrases_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mphrases-manual.txt"), - "metadata_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/") - , "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.json"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mp3.mp3", + ), + "ctonic_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.ctonic.txt", + ), + "pitch_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.pitch.txt", + ), + "tempo_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.tempo-manual.txt", + ), + "sama_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sama-manual.txt", + ), + "sections_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.sections-manual-p.txt", + ), + "phrases_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.mphrases-manual.txt", + ), + "metadata_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/saraga_hindustani/"), + "saraga1.5_hindustani/New Signature by Brajeshwar Mukherjee/Irani Bhairavi Thumri/Irani Bhairavi Thumri.json", + ), } expected_property_types = { diff --git a/tests/datasets/test_slakh.py b/tests/datasets/test_slakh.py index cb70555b8..9d320bc1d 100644 --- a/tests/datasets/test_slakh.py +++ b/tests/datasets/test_slakh.py @@ -16,10 +16,19 @@ def test_track(): expected_attributes = { "track_id": "Track00001-S00", "mtrack_id": "Track00001", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/stems/S00.wav"), - "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/MIDI/S00.mid"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/stems/S00.wav", + ), + "midi_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/MIDI/S00.mid", + ), "metadata_path": ( - os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/metadata.yaml") + os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/metadata.yaml", + ) ), "instrument": "Guitar", "integrated_loudness": -12.82074180245363, @@ -76,12 +85,21 @@ def test_track_full(): expected_attributes = { "track_id": "Track00001-S00", "mtrack_id": "Track00001", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/stems/S00.flac"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "slakh2100_flac_redux/train/Track00001/stems/S00.flac", + ), "midi_path": ( - os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/MIDI/S00.mid") + os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "slakh2100_flac_redux/train/Track00001/MIDI/S00.mid", + ) ), "metadata_path": ( - os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"slakh2100_flac_redux/train/Track00001/metadata.yaml") + os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "slakh2100_flac_redux/train/Track00001/metadata.yaml", + ) ), "instrument": "Guitar", "integrated_loudness": -12.82074180245363, @@ -165,10 +183,19 @@ def test_multitrack(): expected_attributes = { "mtrack_id": "Track00001", - "midi_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/all_src.mid"), - "mix_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/mix.wav"), + "midi_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/all_src.mid", + ), + "mix_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/mix.wav", + ), "metadata_path": ( - os.path.join(os.path.normpath("tests/resources/mir_datasets/slakh/"),"babyslakh_16k/Track00001/metadata.yaml") + os.path.join( + os.path.normpath("tests/resources/mir_datasets/slakh/"), + "babyslakh_16k/Track00001/metadata.yaml", + ) ), "data_split": None, "track_ids": [ diff --git a/tests/datasets/test_tinysol.py b/tests/datasets/test_tinysol.py index f86f397c2..01dc6d5f9 100644 --- a/tests/datasets/test_tinysol.py +++ b/tests/datasets/test_tinysol.py @@ -13,8 +13,10 @@ def test_track(): expected_attributes = { "track_id": "Fl-ord-C4-mf-N-T14d", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tinysol/") - , "audio/Winds/Flute/ordinario/Fl-ord-C4-mf-N-T14d.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tinysol/"), + "audio/Winds/Flute/ordinario/Fl-ord-C4-mf-N-T14d.wav", + ), "dynamics": "mf", "fold": 0, "family": "Winds", diff --git a/tests/datasets/test_tonality_classicaldb.py b/tests/datasets/test_tonality_classicaldb.py index c58042fc6..40207280f 100644 --- a/tests/datasets/test_tonality_classicaldb.py +++ b/tests/datasets/test_tonality_classicaldb.py @@ -15,11 +15,26 @@ def test_track(): track = dataset.track(default_trackid) expected_attributes = { - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"audio/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.wav"), - "key_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"keys/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.txt"), - "spectrum_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"spectrums/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), - "hpcp_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"HPCPs/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), - "musicbrainz_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"),"musicbrainz_metadata/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"), + "audio/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.wav", + ), + "key_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"), + "keys/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.txt", + ), + "spectrum_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"), + "spectrums/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", + ), + "hpcp_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"), + "HPCPs/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", + ), + "musicbrainz_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonality_classicaldb/"), + "musicbrainz_metadata/01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D.json", + ), "title": "01-Allegro__Gloria_in_excelsis_Deo_in_D_Major - D", "track_id": "0", } diff --git a/tests/datasets/test_tonas.py b/tests/datasets/test_tonas.py index d75c82585..c780e3c0d 100644 --- a/tests/datasets/test_tonas.py +++ b/tests/datasets/test_tonas.py @@ -19,9 +19,18 @@ def test_track(): "style": "Debla", "title": "Antonio Mairena", "tuning_frequency": 451.0654725341684, - "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.f0.Corrected"), - "notes_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.notes.Corrected"), - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/tonas/"),"Deblas/01-D_AMairena.wav"), + "f0_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonas/"), + "Deblas/01-D_AMairena.f0.Corrected", + ), + "notes_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonas/"), + "Deblas/01-D_AMairena.notes.Corrected", + ), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/tonas/"), + "Deblas/01-D_AMairena.wav", + ), "track_id": "01-D_AMairena", } diff --git a/tests/datasets/test_vocadito.py b/tests/datasets/test_vocadito.py index fb670ef59..639d991a5 100644 --- a/tests/datasets/test_vocadito.py +++ b/tests/datasets/test_vocadito.py @@ -16,14 +16,29 @@ def test_track(): expected_attributes = { "track_id": "1", - "audio_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Audio/vocadito_1.wav"), + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/vocadito/"), + "Audio/vocadito_1.wav", + ), "singer_id": "S1", "language": "Tagalog", "average_pitch_midi": 50, - "f0_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/F0/vocadito_1_f0.csv"), - "lyrics_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Lyrics/vocadito_1_lyrics.txt"), - "notes_a1_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Notes/vocadito_1_notesA1.csv"), - "notes_a2_path": os.path.join(os.path.normpath("tests/resources/mir_datasets/vocadito/"),"Annotations/Notes/vocadito_1_notesA2.csv"), + "f0_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/vocadito/"), + "Annotations/F0/vocadito_1_f0.csv", + ), + "lyrics_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/vocadito/"), + "Annotations/Lyrics/vocadito_1_lyrics.txt", + ), + "notes_a1_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/vocadito/"), + "Annotations/Notes/vocadito_1_notesA1.csv", + ), + "notes_a2_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/vocadito/"), + "Annotations/Notes/vocadito_1_notesA2.csv", + ), } expected_property_types = { diff --git a/tests/test_core.py b/tests/test_core.py index 77794d739..1427c5868 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -36,7 +36,9 @@ def test_track(): track.to_jams() path_good = track.get_path("annotation") - assert os.path.normpath(path_good) == os.path.normpath("tests/resources/mir_datasets/asdf/asdd") + assert os.path.normpath(path_good) == os.path.normpath( + "tests/resources/mir_datasets/asdf/asdd" + ) path_none = track.get_path("audio") assert path_none is None @@ -191,15 +193,21 @@ def __init__(self, data_home=None, version="default"): dataset = VersionTest("asdf") assert dataset.version == "1" - assert os.path.normpath(dataset.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") + assert os.path.normpath(dataset.index_path) == os.path.normpath( + "asdf/mirdata_indexes/blah_1.json" + ) dataset_default = VersionTest("asdf", version="default") assert dataset_default.version == "1" - assert os.path.normpath(dataset_default.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") + assert os.path.normpath(dataset_default.index_path) == os.path.normpath( + "asdf/mirdata_indexes/blah_1.json" + ) dataset_1 = VersionTest("asdf", version="1") assert dataset_1.version == "1" - assert os.path.normpath(dataset_1.index_path) == os.path.normpath("asdf/mirdata_indexes/blah_1.json") + assert os.path.normpath(dataset_1.index_path) == os.path.normpath( + "asdf/mirdata_indexes/blah_1.json" + ) with pytest.raises(FileNotFoundError): dataset_1._index @@ -228,7 +236,8 @@ def __init__(self, data_home=None, version="default"): dataset_real = VersionTest("asdf", version="real") assert dataset_real.version == "real" assert os.path.normpath(dataset_real.index_path) == os.path.join( - local_index_path, os.path.normpath("mirdata/datasets/indexes/beatles_index_1.2.json") + local_index_path, + os.path.normpath("mirdata/datasets/indexes/beatles_index_1.2.json"), ) idx_test = dataset_real._index assert isinstance(idx_test, dict) @@ -303,7 +312,9 @@ def test_multitrack(): ) path_good = mtrack.get_path("audio_master") - assert os.path.normpath(path_good) == os.path.normpath("tests/resources/mir_datasets/foo/bar") + assert os.path.normpath(path_good) == os.path.normpath( + "tests/resources/mir_datasets/foo/bar" + ) path_none = mtrack.get_path("score") assert path_none is None diff --git a/tests/test_loaders.py b/tests/test_loaders.py index b01155cb7..5acba2ed2 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -256,7 +256,9 @@ def test_track(): for dataset_name in DATASETS: dataset = mirdata.initialize( - dataset_name, os.path.normpath(os.path.join(TEST_DATA_HOME, dataset_name)), version="test" + dataset_name, + os.path.normpath(os.path.join(TEST_DATA_HOME, dataset_name)), + version="test", ) # if the dataset doesn't have a track object, make sure it raises a value error diff --git a/tests/test_utils.py b/tests/test_utils.py index 4a25c4f77..60ceb0024 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -9,7 +9,9 @@ import pytest -DEFAULT_DATA_HOME = os.path.normpath(os.path.join(os.getenv("HOME", "/tmp"), "mir_datasets")) +DEFAULT_DATA_HOME = os.path.normpath( + os.path.join(os.getenv("HOME", "/tmp"), "mir_datasets") +) def run_track_tests(track, expected_attributes, expected_property_types): @@ -115,10 +117,9 @@ def test_md5(mocker): ), ], ) -# mirdata\tests\indexes\test_index_valid.json def test_validate_index(test_index, expected_missing, expected_inv_checksum): index_path = os.path.normpath(os.path.join("tests/indexes", test_index)) - with open(index_path,'r') as index_file: + with open(index_path, "r") as index_file: test_index = json.load(index_file) missing_files, invalid_checksums = validate.validate_index( From 1cbdbf4bf49542f0f3a209dfeb3212a07355ac40 Mon Sep 17 00:00:00 2001 From: Harsh Palan Date: Wed, 23 Nov 2022 15:54:58 -0500 Subject: [PATCH 5/5] updating new testcases and changes for comments --- .../contributing_examples/test_example.py | 2 +- .../datasets/compmusic_jingju_acappella.py | 2 -- mirdata/datasets/compmusic_otmm_makam.py | 1 - mirdata/datasets/saraga_hindustani.py | 1 - tests/datasets/test_carnatic_rhythm.py | 23 ++++++++++----- tests/datasets/test_dali.py | 2 +- tests/datasets/test_haydn_op20.py | 2 +- tests/datasets/test_hindustani_rhythm.py | 29 ++++++++++++++----- tests/datasets/test_indian_tonic.py | 9 ++++-- tests/test_utils.py | 18 ++++++++++-- 10 files changed, 62 insertions(+), 27 deletions(-) diff --git a/docs/source/contributing_examples/test_example.py b/docs/source/contributing_examples/test_example.py index c2ed7af4e..c445b9512 100644 --- a/docs/source/contributing_examples/test_example.py +++ b/docs/source/contributing_examples/test_example.py @@ -40,7 +40,7 @@ def test_to_jams(): default_trackid = "some_id" data_home = "tests/resources/mir_datasets/dataset" - dataset = example.Dataset(data_home, version="test" + dataset = example.Dataset(data_home, version="test") track = dataset.track(default_trackid) jam = track.to_jams() diff --git a/mirdata/datasets/compmusic_jingju_acappella.py b/mirdata/datasets/compmusic_jingju_acappella.py index b42fd7cb1..7751319f3 100644 --- a/mirdata/datasets/compmusic_jingju_acappella.py +++ b/mirdata/datasets/compmusic_jingju_acappella.py @@ -281,7 +281,6 @@ def load_phrases(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] lyrics = [] - # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) @@ -308,7 +307,6 @@ def load_syllable(fhandle: TextIO) -> annotations.LyricData: start_times = [] end_times = [] events = [] - # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter="\t") for line in reader: start_times.append(float(line[0])) diff --git a/mirdata/datasets/compmusic_otmm_makam.py b/mirdata/datasets/compmusic_otmm_makam.py index 26ecacee0..514f0b64b 100644 --- a/mirdata/datasets/compmusic_otmm_makam.py +++ b/mirdata/datasets/compmusic_otmm_makam.py @@ -221,7 +221,6 @@ def _metadata(self): metadata = {} try: with open(metadata_path) as f: - # f.reconfigure(encoding="utf-8") meta = json.load(f) for i in meta: index = i["mbid"].split("/")[-1] diff --git a/mirdata/datasets/saraga_hindustani.py b/mirdata/datasets/saraga_hindustani.py index bae166e01..8b66acc15 100644 --- a/mirdata/datasets/saraga_hindustani.py +++ b/mirdata/datasets/saraga_hindustani.py @@ -379,7 +379,6 @@ def load_sections(fhandle): """ intervals = [] section_labels = [] - # fhandle.reconfigure(encoding="utf-8") reader = csv.reader(fhandle, delimiter=",") for line in reader: if line: diff --git a/tests/datasets/test_carnatic_rhythm.py b/tests/datasets/test_carnatic_rhythm.py index 9f5a6e749..185ce8513 100644 --- a/tests/datasets/test_carnatic_rhythm.py +++ b/tests/datasets/test_carnatic_rhythm.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations from mirdata.datasets import compmusic_carnatic_rhythm @@ -6,18 +7,26 @@ def test_track(): default_trackid = "10003" - data_home = "tests/resources/mir_datasets/compmusic_carnatic_rhythm" + data_home = os.path.normpath( + "tests/resources/mir_datasets/compmusic_carnatic_rhythm" + ) dataset = compmusic_carnatic_rhythm.Dataset(data_home, version="test") track = dataset.track(default_trackid) expected_attributes = { "track_id": "10003", - "audio_path": "tests/resources/mir_datasets/compmusic_carnatic_rhythm/CMR_subset_1.0/" - + "audio/01_10003_1-04_Shri_Visvanatham.wav", - "beats_path": "tests/resources/mir_datasets/compmusic_carnatic_rhythm/CMR_subset_1.0/" - + "annotations/beats/01_10003_1-04_Shri_Visvanatham.beats", - "meter_path": "tests/resources/mir_datasets/compmusic_carnatic_rhythm/CMR_subset_1.0/" - + "annotations/meter/01_10003_1-04_Shri_Visvanatham.meter", + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_carnatic_rhythm/"), + "CMR_subset_1.0/audio/01_10003_1-04_Shri_Visvanatham.wav", + ), + "beats_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_carnatic_rhythm/"), + "CMR_subset_1.0/annotations/beats/01_10003_1-04_Shri_Visvanatham.beats", + ), + "meter_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_carnatic_rhythm/"), + "CMR_subset_1.0/annotations/meter/01_10003_1-04_Shri_Visvanatham.meter", + ), } expected_property_types = { diff --git a/tests/datasets/test_dali.py b/tests/datasets/test_dali.py index 3c306b02e..39489798e 100644 --- a/tests/datasets/test_dali.py +++ b/tests/datasets/test_dali.py @@ -5,7 +5,7 @@ import DALI except ImportError: logging.error( - "In order to use dali you must have dali-dataset installed. " + "In order to test dali you must have dali-dataset installed. " "Please reinstall mirdata using `pip install 'mirdata[dali]' and re-run the tests" ) raise ImportError diff --git a/tests/datasets/test_haydn_op20.py b/tests/datasets/test_haydn_op20.py index d4cf64da3..a481de316 100644 --- a/tests/datasets/test_haydn_op20.py +++ b/tests/datasets/test_haydn_op20.py @@ -5,7 +5,7 @@ import music21 except ImportError: logging.error( - "In order to use haydn_op20 you must have music21 installed. " + "In order to test haydn_op20 you must have music21 installed. " "Please reinstall mirdata using `pip install 'mirdata[haydn_op20] and re-run the tests." ) raise ImportError diff --git a/tests/datasets/test_hindustani_rhythm.py b/tests/datasets/test_hindustani_rhythm.py index aba632137..8b4513cfc 100644 --- a/tests/datasets/test_hindustani_rhythm.py +++ b/tests/datasets/test_hindustani_rhythm.py @@ -1,3 +1,4 @@ +import os import numpy as np from mirdata import annotations from mirdata.datasets import compmusic_hindustani_rhythm @@ -6,18 +7,32 @@ def test_track(): default_trackid = "20001" - data_home = "tests/resources/mir_datasets/compmusic_hindustani_rhythm" + data_home = os.path.normpath( + "tests/resources/mir_datasets/compmusic_hindustani_rhythm" + ) dataset = compmusic_hindustani_rhythm.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { "track_id": "20001", - "audio_path": "tests/resources/mir_datasets/compmusic_hindustani_rhythm/HMR_1.0/" - + "audio/01_20001_02_Raag_Multani.wav", - "beats_path": "tests/resources/mir_datasets/compmusic_hindustani_rhythm/HMR_1.0/" - + "annotations/beats/01_20001_02_Raag_Multani.beats", - "meter_path": "tests/resources/mir_datasets/compmusic_hindustani_rhythm/HMR_1.0/" - + "annotations/meter/01_20001_02_Raag_Multani.meter", + "audio_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_hindustani_rhythm/" + ), + "HMR_1.0/audio/01_20001_02_Raag_Multani.wav", + ), + "beats_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_hindustani_rhythm/" + ), + "HMR_1.0/annotations/beats/01_20001_02_Raag_Multani.beats", + ), + "meter_path": os.path.join( + os.path.normpath( + "tests/resources/mir_datasets/compmusic_hindustani_rhythm/" + ), + "HMR_1.0/annotations/meter/01_20001_02_Raag_Multani.meter", + ), } expected_property_types = { diff --git a/tests/datasets/test_indian_tonic.py b/tests/datasets/test_indian_tonic.py index 62a813dd4..c1108349a 100644 --- a/tests/datasets/test_indian_tonic.py +++ b/tests/datasets/test_indian_tonic.py @@ -1,3 +1,4 @@ +import os import pytest from tests.test_utils import run_track_tests @@ -6,12 +7,14 @@ def test_track(): default_trackid = "0a6ebaa4-87cc-452d-a7af-a2006e96f16a_0-180" - data_home = "tests/resources/mir_datasets/compmusic_indian_tonic" + data_home = os.path.normpath("tests/resources/mir_datasets/compmusic_indian_tonic") dataset = compmusic_indian_tonic.Dataset(data_home) track = dataset.track(default_trackid) expected_attributes = { - "audio_path": "tests/resources/mir_datasets/compmusic_indian_tonic/indian_art_music_tonic_1.0/" - + "CM/audio/0a6ebaa4-87cc-452d-a7af-a2006e96f16a_0-180.mp3", + "audio_path": os.path.join( + os.path.normpath("tests/resources/mir_datasets/compmusic_indian_tonic/"), + "indian_art_music_tonic_1.0/CM/audio/0a6ebaa4-87cc-452d-a7af-a2006e96f16a_0-180.mp3", + ), "track_id": "0a6ebaa4-87cc-452d-a7af-a2006e96f16a_0-180", } diff --git a/tests/test_utils.py b/tests/test_utils.py index 60ceb0024..90dcba1c7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -107,18 +107,30 @@ def test_md5(mocker): ("test_index_valid.json", {"tracks": {}}, {"tracks": {}}), ( "test_index_missing_file.json", - {"tracks": {"10161_chorus": ["tests/resources/10162_chorus.wav"]}}, + { + "tracks": { + "10161_chorus": [ + os.path.normpath("tests/resources/10162_chorus.wav") + ] + } + }, {"tracks": {}}, ), ( "test_index_invalid_checksum.json", {"tracks": {}}, - {"tracks": {"10161_chorus": ["tests/resources/10161_chorus.wav"]}}, + { + "tracks": { + "10161_chorus": [ + os.path.normpath("tests/resources/10161_chorus.wav") + ] + } + }, ), ], ) def test_validate_index(test_index, expected_missing, expected_inv_checksum): - index_path = os.path.normpath(os.path.join("tests/indexes", test_index)) + index_path = os.path.join(os.path.normpath("tests/indexes"), test_index) with open(index_path, "r") as index_file: test_index = json.load(index_file)