diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 6cbea87..93c8c49 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -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 " diff --git a/tests/test_album.py b/tests/test_album.py index c1eb4a8..878e4e1 100755 --- a/tests/test_album.py +++ b/tests/test_album.py @@ -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) diff --git a/tests/test_user.py b/tests/test_user.py index cf37c09..1154fdf 100755 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -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)