def test_de_json_all(self, client): json_dict = {'id_': self.id, 'track_id': self.track_id, 'album_id': self.album_id, 'from_': self.from_} track_id = TrackId.de_json(json_dict, client) assert track_id.id == self.id assert track_id.track_id == self.track_id assert track_id.album_id == self.album_id assert track_id.from_ == self.from_
def de_json(cls, data, client): if not data: return None data = super(TrackShortOld, cls).de_json(data, client) from yandex_music import TrackId data['track_id'] = TrackId.de_json(data.get('track_id'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['Chart']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.Chart`: Элемент чарта. """ if not data: return None data = super(Chart, cls).de_json(data, client) from yandex_music import TrackId data['track_id'] = TrackId.de_json(data.get('track_id'), client) return cls(client=client, **data)
def de_json(cls, data, client): """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`): Объект класса :class:`yandex_music.Client`, представляющий клиент Yandex Music. Returns: :obj:`yandex_music.TrackShortOld`: Объект класса :class:`yandex_music.TrackShortOld`. """ if not data: return None data = super(TrackShortOld, cls).de_json(data, client) from yandex_music import TrackId data['track_id'] = TrackId.de_json(data.get('track_id'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['TrackShortOld']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.TrackShortOld`: Сокращённая версия трека или :obj:`None`. """ if not data: return None data = super(TrackShortOld, cls).de_json(data, client) from yandex_music import TrackId data['track_id'] = TrackId.de_json(data.get('track_id'), client) return cls(client=client, **data)
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) assert track_id.id == self.id