Добавлено новое поле available_regions для Album (#400)

* Добавлено новое поле available_regions для Album
このコミットが含まれているのは:
Gleb Liutsko 2021-01-27 21:02:16 +04:00 committed by GitHub
コミット 35a2165bb2
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
3個のファイルの変更9行の追加2行の削除

ファイルの表示

@ -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()

ファイルの表示

@ -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)

ファイルの表示

@ -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,)