def de_json(cls, data, client): if not data: return None data = super(StationResult, cls).de_json(data, client) from yandex_music import Station, RotorSettings, AdParams data['station'] = Station.de_json(data.get('station'), client) data['settings'] = RotorSettings.de_json(data.get('settings'), client) data['settings2'] = RotorSettings.de_json(data.get('settings2'), client) data['ad_params'] = AdParams.de_json(data.get('ad_params'), client) return cls(client=client, **data)
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 } ad_params = AdParams.de_json(json_dict, client) assert ad_params.partner_id == self.partner_id assert ad_params.category_id == self.category_id assert ad_params.page_ref == self.page_ref assert ad_params.target_ref == self.target_ref assert ad_params.other_params == self.other_params assert ad_params.ad_volume == self.ad_volume
def de_json(cls, data: dict, client: 'Client') -> Optional['StationResult']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.StationResult`: Радиостанция с настройками. """ if not data: return None data = super(StationResult, cls).de_json(data, client) from yandex_music import Station, RotorSettings, AdParams data['station'] = Station.de_json(data.get('station'), client) data['settings'] = RotorSettings.de_json(data.get('settings'), client) data['settings2'] = RotorSettings.de_json(data.get('settings2'), client) data['ad_params'] = AdParams.de_json(data.get('ad_params'), 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.StationResult`: Объект класса :class:`yandex_music.StationResult`. """ if not data: return None data = super(StationResult, cls).de_json(data, client) from yandex_music import Station, RotorSettings, AdParams data['station'] = Station.de_json(data.get('station'), client) data['settings'] = RotorSettings.de_json(data.get('settings'), client) data['settings2'] = RotorSettings.de_json(data.get('settings2'), client) data['ad_params'] = AdParams.de_json(data.get('ad_params'), client) return cls(client=client, **data)
def test_de_json_none(self, client): assert AdParams.de_json({}, client) is None