def test_equality(self, artist, track, album, cover, playlist_id, video, vinyl): a = BriefInfo(artist, [album], [album], self.last_release_ids, [track], [artist], [cover], self.concerts, [video], [vinyl], self.has_promotions, [playlist_id]) b = BriefInfo(artist, [album], [album], self.last_release_ids, [], [artist], [cover], self.concerts, [video], [vinyl], True, [playlist_id]) c = BriefInfo(artist, [album], [album], [1, 2, 3], [track], [artist], [], self.concerts, [video], [vinyl], self.has_promotions, [playlist_id]) d = BriefInfo(artist, [album], [album], self.last_release_ids, [track], [artist], [cover], self.concerts, [video], [vinyl], self.has_promotions, [playlist_id]) assert a != b != c assert hash(a) != hash(b) != hash(c) assert a is not b is not c assert a == d
def test_de_json_required(self, client, artist, track, album, playlist, 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, 'last_releases': [album.to_dict()], 'popular_tracks': [track.to_dict()], 'similar_artists': [artist.to_dict()], 'all_covers': [cover.to_dict()], 'concerts': self.concerts, 'videos': [video.to_dict()], 'vinyls': [vinyl.to_dict()], 'has_promotions': self.has_promotions, 'playlist_ids': [playlist_id.to_dict()], 'playlists': [playlist.to_dict()], } brief_info = BriefInfo.de_json(json_dict, client) assert brief_info.artist == artist assert brief_info.albums == [album] assert brief_info.playlists == [playlist] assert brief_info.also_albums == [album] assert brief_info.last_release_ids == self.last_release_ids assert brief_info.last_releases == [album] assert brief_info.popular_tracks == [track] assert brief_info.similar_artists == [artist] assert brief_info.all_covers == [cover] assert brief_info.concerts == self.concerts assert brief_info.videos == [video] assert brief_info.vinyls == [vinyl] assert brief_info.has_promotions == self.has_promotions assert brief_info.playlist_ids == [playlist_id]
def brief_info(artist, track, album, playlist, cover, playlist_id, video, chart, vinyl): return BriefInfo( artist, [album], [playlist], [album], TestBriefInfo.last_release_ids, [album], [track], [artist], [cover], TestBriefInfo.concerts, [video], [vinyl], TestBriefInfo.has_promotions, [playlist_id], [chart], )
def artists_brief_info(self, artist_id: str or int, timeout=None, *args, **kwargs): url = f'{self.base_url}/artists/{artist_id}/brief-info' result = self._request.get(url, timeout=timeout, *args, **kwargs) return BriefInfo.de_json(result, self)
def test_de_json_none(self, client): assert BriefInfo.de_json({}, client) is None