mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
Fix formatting to pass flake8 tests
This commit is contained in:
parent
a70820d8a1
commit
8f41818434
2 changed files with 53 additions and 10 deletions
|
|
@ -23,12 +23,15 @@ import re
|
|||
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
|
||||
class ArtistNotFoundException(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
|
||||
def split_on_feat(artist):
|
||||
"""Given an artist string, split the "main" artist from any artist
|
||||
on the right-hand side of a string like "feat". Return the main
|
||||
|
|
@ -100,6 +103,7 @@ def find_feat_part(artist, albumartist):
|
|||
|
||||
return feat_part
|
||||
|
||||
|
||||
def ft_in_title(item, drop_feat, loglevel=logging.DEBUG):
|
||||
"""Look for featured artists in the item's artist fields and move
|
||||
them to the title.
|
||||
|
|
|
|||
|
|
@ -25,19 +25,58 @@ class FtInTitlePluginTest(unittest.TestCase):
|
|||
|
||||
def test_find_feat_part(self):
|
||||
test_cases = [
|
||||
{'artist': 'Alice ft. Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice feat Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice featuring Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice & Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice and Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice With Bob', 'album_artist': 'Alice', 'feat_part': 'Bob'},
|
||||
{'artist': 'Alice defeat Bob', 'album_artist': 'Alice', 'feat_part': None},
|
||||
{'artist': 'Alice & Bob', 'album_artist': 'Bob', 'feat_part': 'Alice'},
|
||||
{'artist': 'Alice ft. Bob', 'album_artist': 'Bob', 'feat_part': 'Alice'},
|
||||
{
|
||||
'artist': 'Alice ft. Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice feat Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice featuring Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice & Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice and Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice With Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': 'Bob'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice defeat Bob',
|
||||
'album_artist': 'Alice',
|
||||
'feat_part': None
|
||||
},
|
||||
{
|
||||
'artist': 'Alice & Bob',
|
||||
'album_artist': 'Bob',
|
||||
'feat_part': 'Alice'
|
||||
},
|
||||
{
|
||||
'artist': 'Alice ft. Bob',
|
||||
'album_artist': 'Bob',
|
||||
'feat_part': 'Alice'
|
||||
},
|
||||
]
|
||||
|
||||
for test_case in test_cases:
|
||||
feat_part = ftintitle.find_feat_part(test_case['artist'], test_case['album_artist'])
|
||||
feat_part = ftintitle.find_feat_part(
|
||||
test_case['artist'],
|
||||
test_case['album_artist']
|
||||
)
|
||||
self.assertEqual(feat_part, test_case['feat_part'])
|
||||
|
||||
def test_split_on_feat(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue