Remove dead Last.fm methods: get_top_fans

This commit is contained in:
Hugo 2017-09-25 17:28:02 +03:00
parent d6281e3829
commit 0d4f674ac7
2 changed files with 1 additions and 50 deletions

View file

@ -1252,30 +1252,6 @@ class _BaseObject(object):
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):
"""
Shares this (sends out recommendations).

View file

@ -487,9 +487,7 @@ class TestPyLast(unittest.TestCase):
@handle_lastfm_exceptions
def test_user_is_hashable(self):
# Arrange
artist = self.network.get_artist("Test Artist")
user = artist.get_top_fans(limit=1)[0].item
self.assertIsInstance(user, pylast.User)
user = self.network.get_user(self.username)
# Act/Assert
self.helper_is_thing_hashable(user)
@ -1232,18 +1230,6 @@ class TestPyLast(unittest.TestCase):
# Assert
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
def test_country_top_tracks(self):
# Arrange
@ -1339,17 +1325,6 @@ class TestPyLast(unittest.TestCase):
# Act/Assert
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
# def test_share_spam(self):
# # Arrange