diff --git a/tests/conftest.py b/tests/conftest.py index 8ffe0f8..0991cb5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -116,7 +116,7 @@ def album_factory(label, track_position): TestAlbum.prerolls, volumes, TestAlbum.year, TestAlbum.release_date, TestAlbum.type, track_position, TestAlbum.regions, TestAlbum.available_as_rbt, TestAlbum.lyrics_available, TestAlbum.remember_position, albums, TestAlbum.duration_ms, TestAlbum.explicit, - TestAlbum.start_date, TestAlbum.likes_count, deprecation) + TestAlbum.start_date, TestAlbum.likes_count, deprecation, TestAlbum.available_regions) return AlbumFactory() diff --git a/tests/test_album.py b/tests/test_album.py index d1ca95a..e4e8339 100644 --- a/tests/test_album.py +++ b/tests/test_album.py @@ -43,6 +43,7 @@ class TestAlbum: explicit = False start_date = '2020-06-30' likes_count = 2 + available_regions = ['kg', 'tm', 'by', 'kz', 'md', 'ru', 'am', 'ge', 'uz', 'tj', 'il', 'az', 'ua'] def test_expected_values(self, album, artist_without_tracks, label, track_position, track_without_albums, album_without_nested_albums, deprecation): @@ -89,6 +90,7 @@ class TestAlbum: assert album.start_date == self.start_date assert album.likes_count == self.likes_count assert album.deprecation == deprecation + assert album.available_regions == self.available_regions def test_de_json_none(self, client): assert Album.de_json({}, client) is None @@ -120,7 +122,7 @@ class TestAlbum: 'lyrics_available': self.lyrics_available, 'remember_position': self.remember_position, 'albums': [album_without_nested_albums.to_dict()], 'duration_ms': self.duration_ms, 'explicit': self.explicit, 'start_date': self.start_date, 'likes_count': self.likes_count, - 'deprecation': deprecation.to_dict()} + 'deprecation': deprecation.to_dict(), 'available_regions': self.available_regions} album = Album.de_json(json_dict, client) assert album.id == self.id @@ -166,6 +168,7 @@ class TestAlbum: assert album.start_date == self.start_date assert album.likes_count == self.likes_count assert album.deprecation == deprecation + assert album.available_regions == self.available_regions def test_equality(self, artist, label): a = Album(self.id) diff --git a/yandex_music/album/album.py b/yandex_music/album/album.py index 8b78025..62d3fca 100644 --- a/yandex_music/album/album.py +++ b/yandex_music/album/album.py @@ -61,6 +61,7 @@ class Album(YandexMusicObject): start_date (:obj:`str`): Дата начала в формате ISO 8601 TODO. likes_count (:obj:`int`): Количество лайков TODO. deprecation (:obj:`yandex_music.Deprecation`): TODO. + available_regions (:obj:`list` из :obj:`str`): Регионы, где доступн альбом. client (:obj:`yandex_music.Client`): Клиент Yandex Music. Args: @@ -106,6 +107,7 @@ class Album(YandexMusicObject): start_date (:obj:`str`, optional): Дата начала в формате ISO 8601 TODO. likes_count (:obj:`int`, optional): Количество лайков TODO. deprecation (:obj:`yandex_music.Deprecation`, optional): TODO. + available_regions (:obj:`list` из :obj:`str`, optional): Регионы, где доступн альбом. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. **kwargs: Произвольные ключевые аргументы полученные от API. """ @@ -155,6 +157,7 @@ class Album(YandexMusicObject): start_date: Optional[str] = None, likes_count: Optional[int] = None, deprecation: Optional['Deprecation'] = None, + available_regions: Optional[List[str]] = None, client: Optional['Client'] = None, **kwargs) -> None: self.id = id_ @@ -202,6 +205,7 @@ class Album(YandexMusicObject): self.start_date = start_date self.likes_count = likes_count self.deprecation = deprecation + self.available_regions = available_regions self.client = client self._id_attrs = (self.id,)