user.getArtistTracks has now been removed from Last.fm and returns an error
This commit is contained in:
parent
dedcbf00f5
commit
44d0c2c966
|
@ -2260,11 +2260,10 @@ class User(_BaseObject, _Chartable):
|
|||
|
||||
def get_artist_tracks(self, artist, cacheable=False):
|
||||
"""
|
||||
Deprecated by Last.fm.
|
||||
Get a list of tracks by a given artist scrobbled by this user,
|
||||
including scrobble time.
|
||||
"""
|
||||
# Not implemented:
|
||||
# "Can be limited to specific timeranges, defaults to all time."
|
||||
|
||||
warnings.warn(
|
||||
"User.get_artist_tracks is deprecated and will be removed in a future "
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
|
@ -42,19 +39,6 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
self.assertTrue(hasattr(track, "album"))
|
||||
|
||||
@pytest.mark.skip(reason="Last.fm is removing from API")
|
||||
def test_album_in_artist_tracks(self):
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
track = lastfm_user.get_artist_tracks(artist="Test Artist")[0]
|
||||
|
||||
# Assert
|
||||
self.assertTrue(hasattr(track, "album"))
|
||||
|
||||
def test_album_wiki_content(self):
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
|
|
@ -461,6 +461,17 @@ class TestPyLastUser(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
self.helper_validate_results(result1, result2, result3)
|
||||
|
||||
def test_get_artist_tracks_deprecated(self):
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act / Assert
|
||||
with warnings.catch_warnings(), self.assertRaisesRegex(
|
||||
pylast.WSError, "Deprecated - This type of request is no longer supported"
|
||||
):
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
lastfm_user.get_artist_tracks(artist="Test Artist")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(failfast=True)
|
||||
|
|
Loading…
Reference in a new issue