From 25ae6d6573d797c6f8fcaa12e4c8e110e52c75f1 Mon Sep 17 00:00:00 2001 From: Bulat Shelkhonov Date: Wed, 25 Sep 2024 00:46:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20.r?= =?UTF-8?q?st=20=D0=B4=D0=BE=D0=BA=D1=83,=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB?= =?UTF-8?q?=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/source/yandex_music.artist.rst | 1 + docs/source/yandex_music.artist.stats.rst | 7 +++++++ tests/test_brief_info.py | 9 +++++++-- yandex_music/__init__.py | 2 +- yandex_music/artist/brief_info.py | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 docs/source/yandex_music.artist.stats.rst diff --git a/docs/source/yandex_music.artist.rst b/docs/source/yandex_music.artist.rst index fab914a2..7261d5f6 100644 --- a/docs/source/yandex_music.artist.rst +++ b/docs/source/yandex_music.artist.rst @@ -20,4 +20,5 @@ Submodules yandex_music.artist.description yandex_music.artist.link yandex_music.artist.ratings + yandex_music.artist.stats yandex_music.artist.vinyl diff --git a/docs/source/yandex_music.artist.stats.rst b/docs/source/yandex_music.artist.stats.rst new file mode 100644 index 00000000..22531601 --- /dev/null +++ b/docs/source/yandex_music.artist.stats.rst @@ -0,0 +1,7 @@ +yandex\_music.artist.stats +========================== + +.. automodule:: yandex_music.artist.stats + :members: + :undoc-members: + :show-inheritance: diff --git a/tests/test_brief_info.py b/tests/test_brief_info.py index fb418524..4aabe35f 100644 --- a/tests/test_brief_info.py +++ b/tests/test_brief_info.py @@ -30,7 +30,9 @@ class TestBriefInfo: concerts = None has_promotions = False - def test_expected_values(self, brief_info, artist, track, album, playlist, cover, playlist_id, video, chart, vinyl): + def test_expected_values( + self, brief_info, artist, track, album, playlist, cover, playlist_id, video, chart, vinyl, stats + ): assert brief_info.artist == artist assert brief_info.albums == [album] assert brief_info.playlists == [playlist] @@ -45,6 +47,7 @@ def test_expected_values(self, brief_info, artist, track, album, playlist, cover assert brief_info.vinyls == [vinyl] assert brief_info.has_promotions == self.has_promotions assert brief_info.playlist_ids == [playlist_id] + assert brief_info.stats == stats assert brief_info.tracks_in_chart == [chart] def test_de_json_none(self, client): @@ -84,7 +87,7 @@ def test_de_json_required(self, client, artist, track, album, playlist, cover, p assert brief_info.has_promotions == self.has_promotions assert brief_info.playlist_ids == [playlist_id] - def test_de_json_all(self, client, artist, track, album, playlist, cover, playlist_id, video, chart, vinyl): + def test_de_json_all(self, client, artist, track, album, playlist, cover, playlist_id, video, chart, vinyl, stats): json_dict = { 'artist': artist.to_dict(), 'albums': [album.to_dict()], @@ -101,6 +104,7 @@ def test_de_json_all(self, client, artist, track, album, playlist, cover, playli 'playlist_ids': [playlist_id.to_dict()], 'tracks_in_chart': [chart.to_dict()], 'playlists': [playlist.to_dict()], + 'stats': stats.to_dict(), } brief_info = BriefInfo.de_json(json_dict, client) @@ -118,6 +122,7 @@ def test_de_json_all(self, client, artist, track, album, playlist, cover, playli assert brief_info.vinyls == [vinyl] assert brief_info.has_promotions == self.has_promotions assert brief_info.playlist_ids == [playlist_id] + assert brief_info.stats == stats assert brief_info.tracks_in_chart == [chart] def test_equality(self, artist, track, album, playlist, cover, playlist_id, video, vinyl, stats): diff --git a/yandex_music/__init__.py b/yandex_music/__init__.py index 1bb80673..16ff9b2e 100644 --- a/yandex_music/__init__.py +++ b/yandex_music/__init__.py @@ -170,6 +170,7 @@ 'Experiments', 'Cover', 'Ratings', + 'Stats', 'Counts', 'Link', 'Artist', @@ -275,5 +276,4 @@ 'CustomWave', 'R128', 'LyricsInfo', - 'Stats', ] diff --git a/yandex_music/artist/brief_info.py b/yandex_music/artist/brief_info.py index 98ae4c69..a77eb3fe 100644 --- a/yandex_music/artist/brief_info.py +++ b/yandex_music/artist/brief_info.py @@ -59,7 +59,7 @@ class BriefInfo(YandexMusicModel): vinyls: List['Vinyl'] has_promotions: bool playlist_ids: List['PlaylistId'] - stats: Optional['Stats'] + stats: Optional['Stats'] = None tracks_in_chart: List['Chart'] = field(default_factory=list) client: Optional['ClientType'] = None