def test_load_track(): track = gtzan_genre.Track("country.00000", data_home=TEST_DATA_HOME) assert track.genre == "country" assert track.audio_path == os.path.join(TEST_DATA_HOME, "gtzan_genre/genres", "country/country.00000.wav") assert track.audio()[0].shape == (663300, )
def test_to_jams(): default_trackid = "country.00000" track = gtzan_genre.Track(default_trackid, data_home=TEST_DATA_HOME) jam = track.to_jams() # Validate GTZAN schema assert jam.validate() # Test the that the genre parser of mirdata is correct assert jam.annotations["tag_gtzan"][0].data[0].value == "country"
def test_track(): default_trackid = "country.00000" track = gtzan_genre.Track(default_trackid, data_home=TEST_DATA_HOME) expected_attributes = { 'genre': "country", 'audio_path': "tests/resources/mir_datasets/GTZAN-Genre/" + "gtzan_genre/genres/country/country.00000.wav", 'track_id': "country.00000", } run_track_tests(track, expected_attributes, {}) audio, sr = track.audio assert sr == 22050 assert audio.shape == (663300, )
def test_hiphop(): track = gtzan_genre.Track('hiphop.00000', data_home=TEST_DATA_HOME) assert track.genre == 'hip-hop'
def test_track_default_data_home(): # test data home None track_default = gtzan_genre.Track("country.00000") assert track_default._data_home == os.path.join(DEFAULT_DATA_HOME, "GTZAN-Genre")
def test_repr(): track = gtzan_genre.Track("country.00000", data_home=TEST_DATA_HOME) assert str( track ) == "GTZAN-Genre Track(track_id='country.00000', genre='country')"
def test_unknown_track(): with pytest.raises(ValueError): gtzan_genre.Track("asdfasdf", data_home=TEST_DATA_HOME)