Merge pull request #181 from MarshalX/issue-178

Добавлено опциональное поле version в класс Album.
このコミットが含まれているのは:
Il'ya 2020-01-15 14:20:39 +03:00 committed by GitHub
コミット 43097007c0
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
3個のファイルの変更9行の追加4行の削除

ファイルの表示

@ -81,9 +81,9 @@ def album_factory(label, track_position):
class AlbumFactory:
def get(self, artists, volumes):
return Album(TestAlbum.id, TestAlbum.title, TestAlbum.track_count, artists, [label],
TestAlbum.available, TestAlbum.available_for_premium_users, TestAlbum.cover_uri,
TestAlbum.content_warning, TestAlbum.original_release_year, TestAlbum.genre,
TestAlbum.og_image, TestAlbum.buy, TestAlbum.recent, TestAlbum.very_important,
TestAlbum.available, TestAlbum.available_for_premium_users, TestAlbum.version,
TestAlbum.cover_uri, TestAlbum.content_warning, TestAlbum.original_release_year,
TestAlbum.genre, TestAlbum.og_image, TestAlbum.buy, TestAlbum.recent, TestAlbum.very_important,
TestAlbum.available_for_mobile, TestAlbum.available_partially, TestAlbum.bests,
TestAlbum.prerolls, volumes, TestAlbum.year, TestAlbum.release_date, TestAlbum.type,
track_position, TestAlbum.regions)

ファイルの表示

@ -4,6 +4,7 @@ from yandex_music import Album
class TestAlbum:
id = 5239478
title = 'In the End'
version = 'feat. Mark Van Hoen & Mike Harding'
cover_uri = 'avatars.yandex.net/get-music-content/95061/89c14a7d.a.5239478-1/%%'
track_count = 3
available = True
@ -27,6 +28,7 @@ class TestAlbum:
def test_expected_values(self, album, artist_without_tracks, label, track_position, track_without_albums):
assert album.id == self.id
assert album.title == self.title
assert album.version == self.version
assert album.cover_uri == self.cover_uri
assert album.track_count == self.track_count
assert album.artists == [artist_without_tracks]
@ -75,7 +77,7 @@ class TestAlbum:
def test_de_json_all(self, client, artist, label, track_position, track):
json_dict = {'id_': self.id, 'title': self.title, 'cover_uri': self.cover_uri, 'track_count': self.track_count,
'artists': [artist.to_dict()], 'labels': [label.to_dict()], 'available': self.available,
'available_for_premium_users': self.available_for_premium_users,
'available_for_premium_users': self.available_for_premium_users, 'version': self.version,
'content_warning': self.content_warning, 'original_release_year': self.original_release_year,
'genre': self.genre, 'og_image': self.og_image, 'buy': self.buy, 'recent': self.recent,
'very_important': self.very_important, 'available_for_mobile': self.available_for_mobile,
@ -87,6 +89,7 @@ class TestAlbum:
assert album.id == self.id
assert album.title == self.title
assert album.version == self.version
assert album.cover_uri == self.cover_uri
assert album.track_count == self.track_count
assert album.artists == [artist]

ファイルの表示

@ -15,6 +15,7 @@ class Album(YandexMusicObject):
labels: List['Label'],
available: bool,
available_for_premium_users: bool,
version: Optional[str] = None,
cover_uri: Optional[str] = None,
content_warning=None,
original_release_year=None,
@ -43,6 +44,7 @@ class Album(YandexMusicObject):
self.available_for_premium_users = available_for_premium_users
self.available = available
self.version = version
self.cover_uri = cover_uri
self.genre = genre
self.year = year