From 0d4f674ac7071230b1f14cf5f45dc21cad720993 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 25 Sep 2017 17:28:02 +0300 Subject: [PATCH] Remove dead Last.fm methods: get_top_fans --- pylast/__init__.py | 24 ------------------------ tests/test_pylast.py | 27 +-------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index fd17e99..245e1a3 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -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). diff --git a/tests/test_pylast.py b/tests/test_pylast.py index 0433fb9..a2c27a6 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -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