mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Test written, beginning fix
This commit is contained in:
parent
5e0e898429
commit
84e52e1b4a
2 changed files with 58 additions and 0 deletions
|
|
@ -652,6 +652,7 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
)
|
||||
artist = self.strip_disambiguation(artist)
|
||||
length = self.get_track_length(track["duration"])
|
||||
featured = map(lambda artist: artist["name"] if artist["role"].find("Featuring") else "", track.get("extraartists", []))
|
||||
return TrackInfo(
|
||||
title=title,
|
||||
track_id=track_id,
|
||||
|
|
|
|||
|
|
@ -451,6 +451,63 @@ class DGAlbumInfoTest(BeetsTestCase):
|
|||
assert d.tracks[0].artist == "TEST ARTIST (5)"
|
||||
assert d.label == "LABEL NAME (5)"
|
||||
|
||||
@pytest.mark.parametrize("track, expected_artist",
|
||||
[({
|
||||
"type_": "track",
|
||||
"title": "track",
|
||||
"position": "1",
|
||||
"duration": "5:00",
|
||||
"extraartists": [{
|
||||
"name": "MUSICIAN",
|
||||
"role": "Featuring",
|
||||
}]
|
||||
},
|
||||
"ARTIST feat. MUSICIAN"
|
||||
),
|
||||
({
|
||||
"type_": "track",
|
||||
"title": "track",
|
||||
"position": "1",
|
||||
"duration": "5:00",
|
||||
"extraartists": [{
|
||||
"name": "PERFORMER",
|
||||
"role": "Other Role, Featuring",
|
||||
}, {
|
||||
"name": "MUSICIAN",
|
||||
"role": "Featuring",
|
||||
}]
|
||||
},
|
||||
"ARTIST feat. PERFORMER & MUSICIAN"
|
||||
),
|
||||
({
|
||||
"type_": "track",
|
||||
"title": "track",
|
||||
"position": "1",
|
||||
"duration": "5:00",
|
||||
"artist": "NEW ARTIST",
|
||||
"extraartists": [{
|
||||
"name": "SOLIST",
|
||||
"role": "Featuring",
|
||||
}, {
|
||||
"name": "PERFORMER",
|
||||
"role": "Other Role, Featuring",
|
||||
}, {
|
||||
"name": "RANDOM",
|
||||
"role": "Written-By",
|
||||
}, {
|
||||
"name": "MUSICIAN",
|
||||
"role": "Featuring",
|
||||
}]
|
||||
},
|
||||
"NEW ARTIST feat. SOLIST, PERFORMER & MUSICIAN"
|
||||
)])
|
||||
@patch("beetsplug.discogs.DiscogsPlugin.setup", Mock())
|
||||
def test_parse_featured_artists(track, expected_artist):
|
||||
""" Tests the plugins ability to parse a featured artist.
|
||||
Initial check with one featured artist, two featured artists,
|
||||
and three. Ignores artists that are not listed as featured."""
|
||||
t = DiscogsPlugin().get_track_info(track, 1, 1)
|
||||
assert t.artist == expected_artist
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"formats, expected_media, expected_albumtype",
|
||||
|
|
|
|||
Loading…
Reference in a new issue