def de_json(cls, data, client): if not data: return None data = super(MadeFor, cls).de_json(data, client) from yandex_music import User, CaseForms data['user_info'] = User.de_json(data.get('user_info'), client) data['case_forms'] = CaseForms.de_json(data.get('case_forms'), client) return cls(client=client, **data)
def test_de_json_all(self, client): json_dict = { 'nominative': self.nominative, 'genitive': self.genitive, 'dative': self.dative, 'accusative': self.accusative, 'instrumental': self.instrumental, 'prepositional': self.prepositional } case_forms = CaseForms.de_json(json_dict, client) assert case_forms.nominative == self.nominative assert case_forms.genitive == self.genitive assert case_forms.dative == self.dative assert case_forms.accusative == self.accusative assert case_forms.instrumental == self.instrumental assert case_forms.prepositional == self.prepositional
def de_json(cls, data: dict, client: 'Client') -> Optional['MadeFor']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.MadeFor`: Пользователь, для которого был сделан плейлист. """ if not data: return None data = super(MadeFor, cls).de_json(data, client) from yandex_music import User, CaseForms data['user_info'] = User.de_json(data.get('user_info'), client) data['case_forms'] = CaseForms.de_json(data.get('case_forms'), 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.MadeFor`: Объект класса :class:`yandex_music.MadeFor`. """ if not data: return None data = super(MadeFor, cls).de_json(data, client) from yandex_music import User, CaseForms data['user_info'] = User.de_json(data.get('user_info'), client) data['case_forms'] = CaseForms.de_json(data.get('case_forms'), client) return cls(client=client, **data)
def test_de_json_none(self, client): assert CaseForms.de_json({}, client) is None