Remove dead Last.fm methods: get_top_fans
This commit is contained in:
parent
d6281e3829
commit
0d4f674ac7
|
@ -1252,30 +1252,6 @@ class _BaseObject(object):
|
||||||
|
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
def get_top_fans(self, limit=None, cacheable=True):
|
|
||||||
"""Returns a list of the Users who played this the most.
|
|
||||||
# Parameters:
|
|
||||||
* limit int: Max elements.
|
|
||||||
# For Artist/Track
|
|
||||||
"""
|
|
||||||
|
|
||||||
doc = self._request(self.ws_prefix + '.getTopFans', cacheable)
|
|
||||||
|
|
||||||
seq = []
|
|
||||||
|
|
||||||
elements = doc.getElementsByTagName('user')
|
|
||||||
|
|
||||||
for element in elements:
|
|
||||||
if limit and len(seq) >= limit:
|
|
||||||
break
|
|
||||||
|
|
||||||
name = _extract(element, 'name')
|
|
||||||
weight = _number(_extract(element, 'weight'))
|
|
||||||
|
|
||||||
seq.append(TopItem(User(name, self.network), weight))
|
|
||||||
|
|
||||||
return seq
|
|
||||||
|
|
||||||
def share(self, users, message=None):
|
def share(self, users, message=None):
|
||||||
"""
|
"""
|
||||||
Shares this (sends out recommendations).
|
Shares this (sends out recommendations).
|
||||||
|
|
|
@ -487,9 +487,7 @@ class TestPyLast(unittest.TestCase):
|
||||||
@handle_lastfm_exceptions
|
@handle_lastfm_exceptions
|
||||||
def test_user_is_hashable(self):
|
def test_user_is_hashable(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
artist = self.network.get_artist("Test Artist")
|
user = self.network.get_user(self.username)
|
||||||
user = artist.get_top_fans(limit=1)[0].item
|
|
||||||
self.assertIsInstance(user, pylast.User)
|
|
||||||
|
|
||||||
# Act/Assert
|
# Act/Assert
|
||||||
self.helper_is_thing_hashable(user)
|
self.helper_is_thing_hashable(user)
|
||||||
|
@ -1232,18 +1230,6 @@ class TestPyLast(unittest.TestCase):
|
||||||
# Assert
|
# Assert
|
||||||
self.helper_two_different_things_in_top_list(things, pylast.Album)
|
self.helper_two_different_things_in_top_list(things, pylast.Album)
|
||||||
|
|
||||||
@handle_lastfm_exceptions
|
|
||||||
def test_artist_top_fans(self):
|
|
||||||
# Arrange
|
|
||||||
# Pick an artist with plenty of plays
|
|
||||||
artist = self.network.get_top_artists(limit=1)[0].item
|
|
||||||
|
|
||||||
# Act
|
|
||||||
things = artist.get_top_fans(limit=2)
|
|
||||||
|
|
||||||
# Assert
|
|
||||||
self.helper_two_different_things_in_top_list(things, pylast.User)
|
|
||||||
|
|
||||||
@handle_lastfm_exceptions
|
@handle_lastfm_exceptions
|
||||||
def test_country_top_tracks(self):
|
def test_country_top_tracks(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
@ -1339,17 +1325,6 @@ class TestPyLast(unittest.TestCase):
|
||||||
# Act/Assert
|
# Act/Assert
|
||||||
self.helper_get_assert_charts(lastfm_user, dates[0])
|
self.helper_get_assert_charts(lastfm_user, dates[0])
|
||||||
|
|
||||||
@handle_lastfm_exceptions
|
|
||||||
def test_track_top_fans(self):
|
|
||||||
# Arrange
|
|
||||||
track = self.network.get_track("The Cinematic Orchestra", "Postlude")
|
|
||||||
|
|
||||||
# Act
|
|
||||||
fans = track.get_top_fans()
|
|
||||||
|
|
||||||
# Assert
|
|
||||||
self.helper_at_least_one_thing_in_top_list(fans, pylast.User)
|
|
||||||
|
|
||||||
# Commented out to avoid spamming
|
# Commented out to avoid spamming
|
||||||
# def test_share_spam(self):
|
# def test_share_spam(self):
|
||||||
# # Arrange
|
# # Arrange
|
||||||
|
|
Loading…
Reference in a new issue