Merge pull request #175 from MarshalX/issue-174

Тесты с пустым словарём в de_json и de_list
このコミットが含まれているのは:
Il'ya 2019-12-29 11:11:43 +03:00 committed by GitHub
コミット 0723aed3ae
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
86個のファイルの変更368行の追加2行の削除

ファイルの表示

@ -32,6 +32,9 @@ class TestAccount:
assert account.registered_at == self.registered_at
assert account.has_info_for_app_metrica == self.has_info_for_app_metrica
def test_de_json_none(self, client):
assert Account.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'now': self.now, 'service_available': self.service_available}
account = Account.de_json(json_dict, client)

ファイルの表示

@ -21,6 +21,9 @@ class TestAdParams:
assert ad_params.genre_id == self.genre_id
assert ad_params.genre_name == self.genre_name
def test_de_json_none(self, client):
assert AdParams.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'partner_id': self.partner_id, 'category_id': self.category_id, 'page_ref': self.page_ref,
'target_ref': self.target_ref, 'other_params': self.other_params, 'ad_volume': self.ad_volume}

ファイルの表示

@ -51,6 +51,12 @@ class TestAlbum:
assert album.track_position == track_position
assert album.regions == self.regions
def test_de_json_none(self, client):
assert Album.de_json({}, client) is None
def test_de_list_none(self, client):
assert Album.de_list({}, client) == []
def test_de_json_required(self, client, artist, label):
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()],

ファイルの表示

@ -6,6 +6,12 @@ class TestAlbumEvent:
assert album_event.album == album
assert album_event.tracks == [track]
def test_de_json_none(self, client):
assert AlbumEvent.de_json({}, client) is None
def test_de_list_none(self, client):
assert AlbumEvent.de_list({}, client) == []
def test_de_json_required(self, client, album, track):
json_dict = {'album': album.to_dict(), 'tracks': [track.to_dict()]}
album_event = AlbumEvent.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,12 @@ class TestAlbumsLikes:
assert albums_likes.id == self.id
assert albums_likes.album == album
def test_de_json_none(self, client):
assert AlbumsLikes.de_json({}, client) is None
def test_de_list_none(self, client):
assert AlbumsLikes.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'timestamp': self.timestamp}
albums_likes = AlbumsLikes.de_json(json_dict, client)

ファイルの表示

@ -49,6 +49,12 @@ class TestArtist:
assert artist.init_date == self.init_date
assert artist.end_date == self.end_date
def test_de_json_none(self, client):
assert Artist.de_json({}, client) is None
def test_de_list_none(self, client):
assert Artist.de_list({}, client) == []
def test_de_json_required(self, client, cover):
json_dict = {'id_': self.id, 'name': self.name, 'cover': cover.to_dict()}
artist = Artist.de_json(json_dict, client)

ファイルの表示

@ -13,6 +13,9 @@ class TestArtistAlbums:
assert artist_albums.albums == [album]
assert artist_albums.pager == pager
def test_de_json_none(self, client):
assert ArtistAlbums.de_json({}, client) is None
def test_de_json_required(self, client, album, pager):
json_dict = {'albums': [album.to_dict()], 'pager': pager.to_dict()}
artist_albums = ArtistAlbums.de_json(json_dict, client)

ファイルの表示

@ -7,6 +7,12 @@ class TestArtistEvent:
assert artist_event.tracks == [track]
assert artist_event.similar_to_artists_from_history == [artist]
def test_de_json_none(self, client):
assert ArtistEvent.de_json({}, client) is None
def test_de_list_none(self, client):
assert ArtistEvent.de_list({}, client) == []
def test_de_json_required(self, client, artist, track):
json_dict = {'artist': artist.to_dict(), 'tracks': [track.to_dict()],
'similar_to_artists_from_history': [artist.to_dict()]}

ファイルの表示

@ -13,6 +13,9 @@ class TestArtistTracks:
assert artist_tracks.tracks == [track]
assert artist_tracks.pager == pager
def test_de_json_none(self, client):
assert ArtistTracks.de_json({}, client) is None
def test_de_json_required(self, client, track, pager):
json_dict = {'tracks': [track.to_dict()], 'pager': pager.to_dict()}
artist_tracks = ArtistTracks.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,12 @@ class TestArtistsLikes:
assert artists_likes.artist == artist
assert artists_likes.timestamp == self.timestamp
def test_de_json_none(self, client):
assert ArtistsLikes.de_json({}, client) is None
def test_de_list_none(self, client):
assert ArtistsLikes.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {}
artists_likes = ArtistsLikes.de_json(json_dict, client)

ファイルの表示

@ -18,6 +18,12 @@ class TestAutoRenewable:
assert auto_renewable.finished == self.finished
assert auto_renewable.order_id == self.order_id
def test_de_json_none(self, client):
assert AutoRenewable.de_json({}, client) is None
def test_de_list_none(self, client):
assert AutoRenewable.de_list({}, client) == []
def test_de_json_required(self, client, product):
json_dict = {'expires': self.expires, 'vendor': self.vendor, 'vendor_help_url': self.vendor_help_url,
'product_id': self.product_id, 'product': product.to_dict(), 'finished': self.finished}

ファイルの表示

@ -12,6 +12,9 @@ class TestBest:
assert best.result == result
assert best.text == self.text
def test_de_json_none(self, client):
assert Best.de_json({}, client) is None
def test_de_json_required(self, client, best_with_result):
best_fixture, result = best_with_result

ファイルの表示

@ -27,6 +27,12 @@ class TestBlock:
assert block.description == self.description
assert block.data == data
def test_de_json_none(self, client):
assert Block.de_json({}, client) is None
def test_de_list_none(self, client):
assert Block.de_list({}, client) == []
def test_de_json_required(self, client, block_entity):
json_dict = {'id_': self.id, 'type_': self.type, 'type_for_from': self.type_for_from, 'title': self.title,
'entities': [block_entity.to_dict()]}

ファイルの表示

@ -19,12 +19,18 @@ class TestBlockEntity:
type = 'personal-playlist'
def test_expected_values(self, block_entity_with_data_and_type):
block_entity, data, type = block_entity_with_data_and_type
block_entity, data, type_ = block_entity_with_data_and_type
assert block_entity.id == self.id
assert block_entity.type == type
assert block_entity.type == type_
assert block_entity.data == data
def test_de_list_none(self, client):
assert BlockEntity.de_list({}, client) == []
def test_de_json_none(self, client):
assert BlockEntity.de_json({}, client) is None
def test_de_json_required(self, client, block_entity_data_with_type):
data, type_ = block_entity_data_with_type

ファイルの表示

@ -29,6 +29,9 @@ class TestBriefInfo:
assert brief_info.playlist_ids == [playlist_id]
assert brief_info.tracks_in_chart == [chart]
def test_de_json_none(self, client):
assert BriefInfo.de_json({}, client) is None
def test_de_json_required(self, client, artist, track, album, cover, playlist_id, video, vinyl):
json_dict = {'artist': artist.to_dict(), 'albums': [album.to_dict()], 'also_albums': [album.to_dict()],
'last_release_ids': self.last_release_ids, 'popular_tracks': [track.to_dict()],

ファイルの表示

@ -17,6 +17,9 @@ class TestCaseForms:
assert case_forms.instrumental == self.instrumental
assert case_forms.prepositional == self.prepositional
def test_de_json_none(self, client):
assert CaseForms.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'nominative': self.nominative, 'genitive': self.genitive, 'dative': self.dative,
'accusative': self.accusative, 'instrumental': self.instrumental,

ファイルの表示

@ -14,6 +14,12 @@ class TestChart:
assert chart.shift == self.shift
assert chart.track_id == track_id
def test_de_json_none(self, client):
assert Chart.de_json({}, client) is None
def test_de_list_none(self, client):
assert Chart.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'position': self.position, 'progress': self.progress, 'listeners': self.listeners,
'shift': self.shift}

ファイルの表示

@ -6,6 +6,12 @@ class TestChartItem:
assert chart_item.track == track
assert chart_item.chart == chart
def test_de_json_none(self, client):
assert ChartItem.de_json({}, client) is None
def test_de_list_none(self, client):
assert ChartItem.de_list({}, client) == []
def test_de_json_required(self, client, track, chart):
json_dict = {'track': track.to_dict(), 'chart': chart.to_dict()}
chart_item = ChartItem.de_json(json_dict, client)

ファイルの表示

@ -13,6 +13,9 @@ class TestCounts:
assert counts.also_albums == self.also_albums
assert counts.also_tracks == self.also_tracks
def test_de_json_none(self, client):
assert Counts.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'tracks': self.tracks, 'direct_albums': self.direct_albums, 'also_albums': self.also_albums,
'also_tracks': self.also_tracks}

ファイルの表示

@ -21,6 +21,12 @@ class TestCover:
assert cover.prefix == self.prefix
assert cover.error == self.error
def test_de_json_none(self, client):
assert Cover.de_json({}, client) is None
def test_de_list_none(self, client):
assert Cover.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {}
cover = Cover.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,9 @@ class TestDashboard:
assert dashboard.stations == [station_result]
assert dashboard.pumpkin == self.pumpkin
def test_de_json_none(self, client):
assert Dashboard.de_json({}, client) is None
def test_de_json_required(self, client, station_result):
json_dict = {'dashboard_id': self.dashboard_id, 'stations': [station_result.to_dict()], 'pumpkin': self.pumpkin}
dashboard = Dashboard.de_json(json_dict, client)

ファイルの表示

@ -10,6 +10,12 @@ class TestDay:
assert day.tracks_to_play_with_ads == [track_with_ads]
assert day.tracks_to_play == [track]
def test_de_json_none(self, client):
assert Day.de_json({}, client) is None
def test_de_list_none(self, client):
assert Day.de_list({}, client) == []
def test_de_json_required(self, client, event, track_with_ads, track):
json_dict = {'day': self.day, 'events': [event.to_dict()], 'tracks_to_play_with_ads': [track_with_ads.to_dict()],
'tracks_to_play': [track.to_dict()]}

ファイルの表示

@ -11,6 +11,9 @@ class TestDescription:
assert description.text == self.text
assert description.url == self.url
def test_de_json_none(self, client):
assert Description.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'text': self.text, 'url': self.url}
description = Description.de_json(json_dict, client)

ファイルの表示

@ -11,6 +11,9 @@ class TestDiscreteScale:
assert discrete_scale.min == value
assert discrete_scale.max == value
def test_de_json_none(self, client):
assert DiscreteScale.de_json({}, client) is None
def test_de_json_required(self, client, value):
json_dict = {'type_': self.type, 'name': self.name, 'min_': value.to_dict(), 'max_': value.to_dict()}
discrete_scale = DiscreteScale.de_json(json_dict, client)

ファイルの表示

@ -24,6 +24,12 @@ class TestDownloadInfo:
assert download_info.preview == self.preview
assert download_info.download_info_url == self.download_info_url
def test_de_json_none(self, client):
assert DownloadInfo.de_json({}, client) is None
def test_de_list_none(self, client):
assert DownloadInfo.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'codec': self.codec, 'bitrate_in_kbps': self.bitrate_in_kbps, 'gain': self.gain,
'preview': self.preview, 'download_info_url': self.download_info_url}

ファイルの表示

@ -10,6 +10,9 @@ class TestEnum:
assert enum.name == self.name
assert enum.possible_values == [value]
def test_de_json_none(self, client):
assert Enum.de_json({}, client) is None
def test_de_json_required(self, client, value):
json_dict = {'type_': self.type, 'name': self.name, 'possible_values': [value.to_dict()]}
enum = Enum.de_json(json_dict, client)

ファイルの表示

@ -22,6 +22,12 @@ class TestEvent:
assert event.device == self.device
assert event.tracks_count == self.tracks_count
def test_de_json_none(self, client):
assert Event.de_json({}, client) is None
def test_de_list_none(self, client):
assert Event.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'id_': self.id, 'type_': self.type}
event = Event.de_json(json_dict, client)

ファイルの表示

@ -27,6 +27,9 @@ class TestFeed:
assert feed.days == [day]
assert feed.next_revision == self.next_revision
def test_de_json_none(self, client):
assert Feed.de_json({}, client) is None
def test_de_json_required(self, client, generated_playlist, day):
json_dict = {'can_get_more_events': self.can_get_more_events, 'pumpkin': self.pumpkin,
'is_wizard_passed': self.is_wizard_passed, 'generated_playlists': [generated_playlist.to_dict()],

ファイルの表示

@ -12,6 +12,12 @@ class TestGeneratedPlaylist:
assert generated_playlist.notify == self.notify
assert generated_playlist.data == playlist
def test_de_json_none(self, client):
assert GeneratedPlaylist.de_json({}, client) is None
def test_de_list_none(self, client):
assert GeneratedPlaylist.de_list({}, client) == []
def test_de_json_required(self, client, playlist):
json_dict = {'type_': self.type, 'ready': self.ready, 'notify': self.notify, 'data': playlist.to_dict()}
generated_playlist = GeneratedPlaylist.de_json(json_dict, client)

ファイルの表示

@ -42,6 +42,12 @@ class TestGenre:
assert genre.sub_genres == [genre_without_sub_genre]
assert genre.hide_in_regions == self.hide_in_regions
def test_de_json_none(self, client):
assert Genre.de_json({}, client) is None
def test_de_list_none(self, client):
assert Genre.de_list({}, client) == []
def test_de_json_required(self, client, title, images):
json_dict = {'id_': self.id, 'weight': self.weight, 'composer_top': self.composer_top, 'title': self.title,
'titles': {'uz': title.to_dict()}, 'images': images.to_dict(), 'show_in_menu': self.show_in_menu}

ファイルの表示

@ -9,6 +9,9 @@ class TestIcon:
assert icon.background_color == self.background_color
assert icon.image_url == self.image_url
def test_de_json_none(self, client):
assert Icon.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'background_color': self.background_color, 'image_url': self.image_url}
icon = Icon.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestId:
assert id_.type == self.type
assert id_.tag == self.tag
def test_de_json_none(self, client):
assert Id.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'type_': self.type, 'tag': self.tag}
id_ = Id.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestImages:
assert images._208x208 == self._208x208
assert images._300x300 == self._300x300
def test_de_json_none(self, client):
assert Images.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {}
images = Images.de_json(json_dict, client)

ファイルの表示

@ -11,6 +11,9 @@ class TestInvocationInfo:
assert invocation_info.req_id == self.req_id
assert invocation_info.exec_duration_millis == self.exec_duration_millis
def test_de_json_none(self, client):
assert InvocationInfo.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'hostname': self.hostname, 'req_id': self.req_id}
invocation_info = InvocationInfo.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,12 @@ class TestLabel:
assert label.id == self.id
assert label.name == self.name
def test_de_list_none(self, client):
assert Label.de_list({}, client) == []
def test_de_json_none(self, client):
assert Label.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'id_': self.id, 'name': self.name}
label = Label.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,9 @@ class TestLanding:
assert landing.content_id == self.content_id
assert landing.blocks == [block]
def test_de_json_none(self, client):
assert Landing.de_json({}, client) is None
def test_de_json_required(self, client, block):
json_dict = {'pumpkin': self.pumpkin, 'content_id': self.content_id, 'blocks': [block.to_dict()]}
landing = Landing.de_json(json_dict, client)

ファイルの表示

@ -13,6 +13,12 @@ class TestLink:
assert link.type == self.type
assert link.social_network == self.social_network
def test_de_json_none(self, client):
assert Link.de_json({}, client) is None
def test_de_list_none(self, client):
assert Link.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'title': self.title, 'href': self.href, 'type_': self.type}
link = Link.de_json(json_dict, client)

ファイルの表示

@ -32,6 +32,9 @@ class TestLyrics:
assert lyrics.text_language == self.text_language
assert lyrics.show_translation == self.show_translation
def test_de_json_none(self, client):
assert Lyrics.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'id_': self.id, 'lyrics': self.lyrics, 'full_lyrics': self.full_lyrics,
'has_rights': self.has_rights, 'text_language': self.text_language,

ファイルの表示

@ -6,6 +6,9 @@ class TestMadeFor:
assert made_for.user_info == user
assert made_for.case_forms == case_forms
def test_de_json_none(self, client):
assert MadeFor.de_json({}, client) is None
def test_de_json_required(self, client, user, case_forms):
json_dict = {'user_info': user.to_dict(), 'case_forms': case_forms.to_dict()}
made_for = MadeFor.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestMajor:
assert major.id == self.id
assert major.name == self.name
def test_de_json_none(self, client):
assert Major.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'id_': self.id, 'name': self.name}
major = Major.de_json(json_dict, client)

ファイルの表示

@ -19,6 +19,12 @@ class TestMixLink:
assert mix_link.background_image_uri == self.background_image_uri
assert mix_link.cover_white == self.cover_white
def test_de_json_none(self, client):
assert MixLink.de_json({}, client) is None
def test_de_list_none(self, client):
assert MixLink.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'title': self.title, 'url': self.url, 'url_scheme': self.url_scheme, 'text_color': self.text_color,
'background_color': self.background_color, 'background_image_uri': self.background_image_uri,

ファイルの表示

@ -9,6 +9,9 @@ class TestNormalization:
assert normalization.gain == self.gain
assert normalization.peak == self.peak
def test_de_json_none(self, client):
assert Normalization.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'gain': self.gain, 'peak': self.peak}
normalization = Normalization.de_json(json_dict, client)

ファイルの表示

@ -11,6 +11,9 @@ class TestPager:
assert pager.page == self.page
assert pager.per_page == self.per_page
def test_de_json_none(self, client):
assert Pager.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'total': self.total, 'page': self.page, 'per_page': self.per_page}
pager = Pager.de_json(json_dict, client)

ファイルの表示

@ -7,6 +7,12 @@ class TestPassportPhone:
def test_expected_values(self, passport_phone):
assert passport_phone.phone == self.phone
def test_de_json_none(self, client):
assert PassportPhone.de_json({}, client) is None
def test_de_list_none(self, client):
assert PassportPhone.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'phone': self.phone}
passport_phone = PassportPhone.de_json(json_dict, client)

ファイルの表示

@ -14,6 +14,9 @@ class TestPermissionAlerts:
def test_expected_values(self, permission_alerts):
assert permission_alerts.alerts == self.alerts
def test_de_json_none(self, client):
assert PermissionAlerts.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'alerts': self.alerts}
permission_alerts = PermissionAlerts.de_json(json_dict, client)

ファイルの表示

@ -11,6 +11,9 @@ class TestPermissions:
assert permissions.values == self.values
assert permissions.default == self.default
def test_de_json_none(self, client):
assert Permissions.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'until': self.until, 'values': self.values, 'default': self.default}
permissions = Permissions.de_json(json_dict, client)

ファイルの表示

@ -7,6 +7,9 @@ class TestPersonalPlaylistsData:
def test_expected_values(self, personal_playlists_data):
assert personal_playlists_data.is_wizard_passed == self.is_wizard_passed
def test_de_json_none(self, client):
assert PersonalPlaylistsData.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'is_wizard_passed': self.is_wizard_passed}
personal_playlists_data = PersonalPlaylistsData.de_json(json_dict, client)

ファイルの表示

@ -12,6 +12,9 @@ class TestPlayContext:
assert play_context.context_item == self.context_item
assert play_context.tracks == [track_short_old]
def test_de_json_none(self, client):
assert PlayContext.de_json({}, client) is None
def test_de_json_required(self, client, track_short_old):
json_dict = {'client_': self.client_, 'context': self.context, 'context_item': self.context_item,
'tracks': [track_short_old.to_dict()]}

ファイルの表示

@ -5,6 +5,9 @@ class TestPlayContextsData:
def test_expected_values(self, play_contexts_data, track_short_old):
assert play_contexts_data.other_tracks == [track_short_old]
def test_de_json_none(self, client):
assert PlayContextsData.de_json({}, client) is None
def test_de_json_required(self, client, track_short_old):
json_dict = {'other_tracks': [track_short_old.to_dict()]}
play_contexts_data = PlayContextsData.de_json(json_dict, client)

ファイルの表示

@ -11,6 +11,9 @@ class TestPlayCounter:
assert play_counter.description == self.description
assert play_counter.updated == self.updated
def test_de_json_none(self, client):
assert PlayCounter.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'value': self.value, 'description': self.description, 'updated': self.updated}
play_counter = PlayCounter.de_json(json_dict, client)

ファイルの表示

@ -61,6 +61,12 @@ class TestPlaylist:
assert playlist.is_for_from == self.is_for_from
assert playlist.regions == self.regions
def test_de_json_none(self, client):
assert Playlist.de_json({}, client) is None
def test_de_list_none(self, client):
assert Playlist.de_list({}, client) == []
def test_de_json_required(self, client, user, cover, made_for, play_counter, playlist_absence):
json_dict = {'owner': user.to_dict(), 'uid': self.uid, 'kind': self.kind, 'title': self.title,
'track_count': self.track_count, 'cover': cover.to_dict(), 'made_for': made_for.to_dict(),

ファイルの表示

@ -9,6 +9,9 @@ class TestPlaylistAbsence:
assert playlist_absence.kind == self.kind
assert playlist_absence.reason == self.reason
def test_de_json_none(self, client):
assert PlaylistAbsence.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'kind': self.kind, 'reason': self.reason}
playlist_absence = PlaylistAbsence.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,12 @@ class TestPlaylistId:
assert playlist_id.uid == self.uid
assert playlist_id.kind == self.kind
def test_de_json_none(self, client):
assert PlaylistId.de_json({}, client) is None
def test_de_list_none(self, client):
assert PlaylistId.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'uid': self.uid, 'kind': self.kind}
playlist_id = PlaylistId.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,12 @@ class TestPlaylistsLikes:
assert playlists_likes.id == self.id
assert playlists_likes.playlist == playlist
def test_de_json_none(self, client):
assert PlaylistsLikes.de_json({}, client) is None
def test_de_list_none(self, client):
assert PlaylistsLikes.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'timestamp': self.timestamp}
playlists_likes = PlaylistsLikes.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestPlus:
assert plus.has_plus == self.has_plus
assert plus.is_tutorial_completed == self.is_tutorial_completed
def test_de_json_none(self, client):
assert Plus.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'has_plus': self.has_plus, 'is_tutorial_completed': self.is_tutorial_completed}
plus = Plus.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestPrice:
assert price.amount == self.amount
assert price.currency == self.currency
def test_de_json_none(self, client):
assert Price.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'amount': self.amount, 'currency': self.currency}
price = Price.de_json(json_dict, client)

ファイルの表示

@ -36,6 +36,12 @@ class TestProduct:
assert product.button_additional_text == self.button_additional_text
assert product.payment_method_types == self.payment_method_types
def test_de_json_none(self, client):
assert Product.de_json({}, client) is None
def test_de_list_none(self, client):
assert Product.de_list({}, client) == []
def test_de_json_required(self, client, price):
json_dict = {'product_id': self.product_id, 'type_': self.type,
'common_period_duration': self.common_period_duration, 'duration': self.duration,

ファイルの表示

@ -17,6 +17,9 @@ class TestPromoCodeStatus:
assert promo_code_status.status_desc == self.status_desc
assert promo_code_status.account_status == status
def test_de_json_none(self, client):
assert PromoCodeStatus.de_json({}, client) is None
def test_de_json_required(self, client, status):
json_dict = {'status': self.status, 'status_desc': self.status_desc, 'account_status': status.to_dict()}
promo_code_status = PromoCodeStatus.de_json(json_dict, client)

ファイルの表示

@ -23,6 +23,12 @@ class TestPromotion:
assert promotion.gradient == self.gradient
assert promotion.image == self.image
def test_de_list_none(self, client):
assert Promotion.de_list({}, client) == []
def test_de_json_none(self, client):
assert Promotion.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'promo_id': self.promo_id, 'title': self.title, 'subtitle': self.subtitle, 'heading': self.heading,
'url': self.url, 'url_scheme': self.url_scheme, 'text_color': self.text_color,

ファイルの表示

@ -11,6 +11,9 @@ class TestRatings:
assert ratings.month == self.month
assert ratings.day == self.day
def test_de_json_none(self, client):
assert Ratings.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'week': self.week, 'month': self.month}
ratings = Ratings.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestRestrictions:
assert restrictions.energy == discrete_scale
assert restrictions.mood_energy == enum
def test_de_json_none(self, client):
assert Restrictions.de_json({}, client) is None
def test_de_json_required(self, client, enum):
json_dict = {'language': enum.to_dict(), 'diversity': enum.to_dict()}
restrictions = Restrictions.de_json(json_dict, client)

ファイルの表示

@ -15,6 +15,9 @@ class TestRotorSettings:
assert rotor_settings.energy == self.energy
assert rotor_settings.mood_energy == self.mood_energy
def test_de_json_none(self, client):
assert RotorSettings.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'language': self.language, 'diversity': self.diversity}
rotor_settings = RotorSettings.de_json(json_dict, client)

ファイルの表示

@ -39,6 +39,9 @@ class TestSearch:
assert search.misspell_corrected == self.misspell_corrected
assert search.nocorrect == self.nocorrect
def test_de_json_none(self, client):
assert Search.de_json({}, client) is None
def test_de_json_required(self, client, best, search_result):
json_dict = {'search_request_id': self.search_request_id, 'text': self.text, 'best': best.to_dict(),
'albums': search_result(3).to_dict(), 'artists': search_result(2).to_dict(),

ファイルの表示

@ -14,6 +14,9 @@ class TestSearchResult:
assert search_result.order == self.order
assert search_result.results == results
def test_de_json_none(self, client):
assert SearchResult.de_json({}, client) is None
def test_de_json_required(self, client, result_with_type):
result, type = result_with_type

ファイルの表示

@ -10,6 +10,12 @@ class TestSequence:
assert sequence.track == track
assert sequence.liked == self.liked
def test_de_json_none(self, client):
assert Sequence.de_json({}, client) is None
def test_de_list_none(self, client):
assert Sequence.de_list({}, client) == []
def test_de_json_required(self, client, track):
json_dict = {'type_': self.type, 'track': track.to_dict(), 'liked': self.liked}
sequence = Sequence.de_json(json_dict, client)

ファイルの表示

@ -12,6 +12,9 @@ class TestSettings:
assert settings.promo_codes_enabled == self.promo_codes_enabled
assert settings.web_payment_month_product_price == price
def test_de_json_none(self, client):
assert Settings.de_json({}, client) is None
def test_de_json_required(self, client, product):
json_dict = {'in_app_products': [product.to_dict()], 'native_products': [product.to_dict()],
'web_payment_url': self.web_payment_url, 'promo_codes_enabled': self.promo_codes_enabled}

ファイルの表示

@ -16,6 +16,9 @@ class TestStation:
assert station.restrictions2 == restrictions
assert station.parent_id == id_
def test_de_json_none(self, client):
assert Station.de_json({}, client) is None
def test_de_json_required(self, client, id_, icon, restrictions):
json_dict = {'id_': id_.to_dict(), 'name': self.name, 'icon': icon.to_dict(), 'mts_icon': icon.to_dict(),
'geocell_icon': icon.to_dict(), 'id_for_from': self.id_for_from,

ファイルの表示

@ -13,6 +13,12 @@ class TestStationResult:
assert station_result.explanation == self.explanation
assert station_result.prerolls == self.prerolls
def test_de_json_none(self, client):
assert StationResult.de_json({}, client) is None
def test_de_list_none(self, client):
assert StationResult.de_list({}, client) == []
def test_de_json_required(self, client, station, rotor_settings, ad_params):
json_dict = {'station': station.to_dict(), 'settings': rotor_settings.to_dict(),
'settings2': rotor_settings.to_dict(), 'ad_params': ad_params.to_dict()}

ファイルの表示

@ -18,6 +18,9 @@ class TestStationTracksResult:
assert station_tracks_result.batch_id == self.batch_id
assert station_tracks_result.pumpkin == self.pumpkin
def test_de_json_none(self, client):
assert StationTracksResult.de_json({}, client) is None
def test_de_json_required(self, client, id_, sequence):
json_dict = {'id_': id_.to_dict(), 'sequence': [sequence.to_dict()], 'batch_id': self.batch_id,
'pumpkin': self.pumpkin}

ファイルの表示

@ -23,6 +23,9 @@ class TestStatus:
assert status.station_exists == self.station_exists
assert status.premium_region == self.premium_region
def test_de_json_none(self, client):
assert Status.de_json({}, client) is None
def test_de_json_required(self, client, account, permissions):
json_dict = {'account': account.to_dict(), 'permissions': permissions.to_dict()}
status = Status.de_json(json_dict, client)

ファイルの表示

@ -12,6 +12,9 @@ class TestSubscription:
assert subscription.mcdonalds == self.mcdonalds
assert subscription.end == self.end
def test_de_json_none(self, client):
assert Subscription.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {}
subscription = Subscription.de_json(json_dict, client)

ファイルの表示

@ -23,6 +23,9 @@ class TestSuggestions:
assert suggestions.best == best
assert suggestions.suggestions == self.suggestions
def test_de_json_none(self, client):
assert Suggestions.de_json({}, client) is None
def test_de_json_required(self, client, best):
json_dict = {'best': best.to_dict(), 'suggestions': self.suggestions}
suggestions = Suggestions.de_json(json_dict, client)

ファイルの表示

@ -18,6 +18,9 @@ class TestSupplement:
assert supplement.videos == [video_supplement]
assert supplement.radio_is_available == self.radio_is_available
def test_de_json_none(self, client):
assert Supplement.de_json({}, client) is None
def test_de_json_required(self, client, lyrics, video_supplement):
json_dict = {'id_': self.id, 'lyrics': lyrics.to_dict(), 'videos': [video_supplement.to_dict()],
'radio_is_available': self.radio_is_available}

ファイルの表示

@ -9,6 +9,9 @@ class TestTitle:
assert title.title == self.title
assert title.full_title == self.full_title
def test_de_json_none(self, client):
assert Title.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'title': self.title}
title = Title.de_json(json_dict, client)

ファイルの表示

@ -47,6 +47,12 @@ class TestTrack:
assert track.preview_duration_ms == self.preview_duration_ms
assert track.available_full_without_permission == self.available_full_without_permission
def test_de_json_none(self, client):
assert Track.de_json({}, client) is None
def test_de_list_none(self, client):
assert Track.de_list({}, client) == []
def test_de_json_required(self, client, artist, album):
json_dict = {'id_': self.id, 'title': self.title, 'available': self.available,
'artists': [artist.to_dict()], 'albums': [album.to_dict()]}

ファイルの表示

@ -9,6 +9,9 @@ class TestTrackId:
assert track_id.id == self.id
assert track_id.album_id == self.album_id
def test_de_json_none(self, client):
assert TrackId.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'id_': self.id}
track_id = TrackId.de_json(json_dict, client)

ファイルの表示

@ -9,6 +9,9 @@ class TestTrackPosition:
assert track_position.volume == self.volume
assert track_position.index == self.index
def test_de_json_none(self, client):
assert TrackPosition.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'volume': self.volume, 'index': self.index}
track_position = TrackPosition.de_json(json_dict, client)

ファイルの表示

@ -18,6 +18,12 @@ class TestTrackShort:
assert track_short.timestamp == self.timestamp
assert track_short.album_id == self.album_id
def test_de_json_none(self, client):
assert TrackShort.de_json({}, client) is None
def test_de_list_none(self, client):
assert TrackShort.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'id_': self.id, 'timestamp': self.timestamp}
track_short = TrackShort.de_json(json_dict, client)

ファイルの表示

@ -8,6 +8,12 @@ class TestTrackShortOld:
assert track_short_old.track_id == track_id
assert track_short_old.timestamp == self.timestamp
def test_de_json_none(self, client):
assert TrackShortOld.de_json({}, client) is None
def test_de_list_none(self, client):
assert TrackShortOld.de_list({}, client) == []
def test_de_json_required(self, client, track_id):
json_dict = {'track_id': track_id.to_dict(), 'timestamp': self.timestamp}
track_short_old = TrackShortOld.de_json(json_dict, client)

ファイルの表示

@ -8,6 +8,12 @@ class TestTrackWithAds:
assert track_with_ads.type == self.type
assert track_with_ads.track == track
def test_de_json_none(self, client):
assert TrackWithAds.de_json({}, client) is None
def test_de_list_none(self, client):
assert TrackWithAds.de_list({}, client) == []
def test_de_json_required(self, client, track):
json_dict = {'type_': self.type, 'track': track.to_dict()}
track_with_ads = TrackWithAds.de_json(json_dict, client)

ファイルの表示

@ -17,6 +17,9 @@ class TestTracksList:
assert tracks_list.revision == self.revision
assert tracks_list.tracks == [track_short]
def test_de_json_none(self, client):
assert TracksList.de_json({}, client) is None
def test_de_json_required(self, client, track_short):
json_dict = {'uid': self.uid, 'revision': self.revision, 'tracks': [track_short.to_dict()]}
tracks_list = TracksList.de_json(json_dict, client)

ファイルの表示

@ -15,6 +15,9 @@ class TestUser:
assert user.sex == self.sex
assert user.verified == self.verified
def test_de_json_none(self, client):
assert User.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'uid': self.uid, 'login': self.login, 'name': self.name, 'sex': self.sex,
'verified': self.verified}

ファイルの表示

@ -9,6 +9,12 @@ class TestValue:
assert value.value == self.value
assert value.name == self.name
def test_de_json_none(self, client):
assert Value.de_json({}, client) is None
def test_de_list_none(self, client):
assert Value.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'value': self.value, 'name': self.name}
value = Value.de_json(json_dict, client)

ファイルの表示

@ -27,6 +27,12 @@ class TestVideo:
assert video.html_auto_play_video_player == self.html_auto_play_video_player
assert video.regions == self.regions
def test_de_json_none(self, client):
assert Video.de_json({}, client) is None
def test_de_list_none(self, client):
assert Video.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'title': self.title}
video = Video.de_json(json_dict, client)

ファイルの表示

@ -21,6 +21,12 @@ class TestVideoSupplement:
assert video_supplement.embed_url == self.embed_url
assert video_supplement.embed == self.embed
def test_de_json_none(self, client):
assert VideoSupplement.de_json({}, client) is None
def test_de_list_none(self, client):
assert VideoSupplement.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'cover': self.cover, 'title': self.title, 'provider': self.provider,
'provider_video_id': self.provider_video_id}

ファイルの表示

@ -17,6 +17,12 @@ class TestVinyl:
assert vinyl.price == self.price
assert vinyl.media == self.media
def test_de_json_none(self, client):
assert Vinyl.de_json({}, client) is None
def test_de_list_none(self, client):
assert Vinyl.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'url': self.url, 'picture': self.picture, 'title': self.title, 'year': self.year,
'price': self.price, 'media': self.media}