Remove Track._artists workaround
This commit is contained in:
parent
9499250a7f
commit
fce5964395
@ -148,6 +148,9 @@ class Track(ImmutableObject):
|
||||
#: The track name. Read-only.
|
||||
name = None
|
||||
|
||||
#: A set of track artists. Read-only.
|
||||
artists = frozenset()
|
||||
|
||||
#: The track :class:`Album`. Read-only.
|
||||
album = None
|
||||
|
||||
@ -167,14 +170,9 @@ class Track(ImmutableObject):
|
||||
musicbrainz_id = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._artists = frozenset(kwargs.pop('artists', []))
|
||||
self.__dict__['artists'] = frozenset(kwargs.pop('artists', []))
|
||||
super(Track, self).__init__(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def artists(self):
|
||||
"""List of :class:`Artist`. Read-only."""
|
||||
return list(self._artists)
|
||||
|
||||
def mpd_format(self, *args, **kwargs):
|
||||
return translator.track_to_mpd_format(self, *args, **kwargs)
|
||||
|
||||
|
||||
@ -39,11 +39,11 @@ class GenericCopyTets(unittest.TestCase):
|
||||
self.assertEqual('bar', copy.uri)
|
||||
|
||||
def test_copying_track_with_private_internal_value(self):
|
||||
artists1 = [Artist(name='foo')]
|
||||
artists2 = [Artist(name='bar')]
|
||||
track = Track(artists=artists1)
|
||||
copy = track.copy(artists=artists2)
|
||||
self.assertEqual(copy.artists, artists2)
|
||||
artist1 = Artist(name='foo')
|
||||
artist2 = Artist(name='bar')
|
||||
track = Track(artists=[artist1])
|
||||
copy = track.copy(artists=[artist2])
|
||||
self.assert_(artist2 in copy.artists)
|
||||
|
||||
def test_copying_track_with_invalid_key(self):
|
||||
test = lambda: Track().copy(invalid_key=True)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user