diff --git a/tests/test_album.py b/tests/test_album.py index ad1cd70..715e303 100644 --- a/tests/test_album.py +++ b/tests/test_album.py @@ -1,12 +1,9 @@ -import pytest - from yandex_music import Album -from yandex_music.exceptions import YandexMusicError class TestAlbum: id = 5239478 - error = None + error = 'not-found' title = 'In the End' version = 'feat. Mark Van Hoen & Mike Harding' cover_uri = 'avatars.yandex.net/get-music-content/95061/89c14a7d.a.5239478-1/%%' @@ -50,10 +47,6 @@ class TestAlbum: likes_count = 2 available_regions = ['kg', 'tm', 'by', 'kz', 'md', 'ru', 'am', 'ge', 'uz', 'tj', 'il', 'az', 'ua'] - def test_raise_on_model_error(self): - with pytest.raises(YandexMusicError): - Album(error='not-found') - def test_expected_values( self, album, @@ -116,7 +109,7 @@ class TestAlbum: assert Album.de_list({}, client) == [] def test_de_json_required(self, client): - json_dict = {} + json_dict = {'id': self.id} album = Album.de_json(json_dict, client) def test_de_json_all(self, client, artist, label, track_position, track, album_without_nested_albums, deprecation): diff --git a/tests/test_artist.py b/tests/test_artist.py index 28ed39d..edcf696 100644 --- a/tests/test_artist.py +++ b/tests/test_artist.py @@ -1,13 +1,10 @@ -import pytest - from yandex_music import Artist -from yandex_music.exceptions import YandexMusicError class TestArtist: id = 10987 - error = None - reason = None + error = 'not-found' + reason = 'not-found' name = 'Elvis Presley' various = False composer = None @@ -32,13 +29,6 @@ class TestArtist: end_date = None ya_money_id = '4100170623944' - def test_raise_on_model_error(self): - with pytest.raises(YandexMusicError): - Artist(id=self.id, error='not_found') - - with pytest.raises(YandexMusicError): - Artist(id=self.id, reason='not_found') - def test_expected_values( self, artist, cover, counts, ratings, link, track_without_artists_and_albums, description, artist_decomposed ): diff --git a/tests/test_cover.py b/tests/test_cover.py index 0849f2e..ce82c37 100644 --- a/tests/test_cover.py +++ b/tests/test_cover.py @@ -1,7 +1,4 @@ -import pytest - from yandex_music import Cover -from yandex_music.exceptions import YandexMusicError class TestCover: @@ -17,10 +14,6 @@ class TestCover: copyright_cline = 'imago stock&people' error = None - def test_raise_on_model_error(self): - with pytest.raises(YandexMusicError): - Cover(error='not_found') - def test_expected_values(self, cover): assert cover.type == self.type assert cover.uri == self.uri diff --git a/tests/test_track.py b/tests/test_track.py index 6c4e1e1..79eb34a 100644 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -1,7 +1,4 @@ -import pytest - from yandex_music import Track -from yandex_music.exceptions import YandexMusicError class TestTrack: @@ -40,10 +37,6 @@ class TestTrack: ) is_suitable_for_children = True - def test_raise_on_model_error(self): - with pytest.raises(YandexMusicError): - Track(id=self.id, error='not-found') - def test_expected_values( self, track, diff --git a/yandex_music/artist/artist.py b/yandex_music/artist/artist.py index fda1266..1e22d3f 100644 --- a/yandex_music/artist/artist.py +++ b/yandex_music/artist/artist.py @@ -80,7 +80,7 @@ class Artist(YandexMusicObject): client: 'Client' = None def __post_init__(self): - if self.error or self.reason: + if self.error: raise YandexMusicError(self.error) self._id_attrs = (self.id, self.name, self.cover)