def test_equality(self): a = Value(self.value, self.name) b = Value(self.value, '') c = Value(self.value, self.name) assert a != b assert hash(a) != hash(b) assert a is not b assert a == c
def de_json(cls, data, client): if not data: return None data = super(DiscreteScale, cls).de_json(data, client) from yandex_music import Value data['min'] = Value.de_json(data.get('min'), client) data['max'] = Value.de_json(data.get('max'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['DiscreteScale']: if not data: return None data = super(DiscreteScale, cls).de_json(data, client) from yandex_music import Value data['min_'] = Value.de_json(data.get('min_'), client) data['max_'] = Value.de_json(data.get('max_'), client) return cls(client=client, **data)
def de_json(cls, data, client): if not data: return None data = super(Enum, cls).de_json(data, client) from yandex_music import Value data['possible_values'] = Value.de_list(data.get('possible_values'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['DiscreteScale']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.DiscreteScale`: Дискретное значение. """ if not data: return None data = super(DiscreteScale, cls).de_json(data, client) from yandex_music import Value data['min_'] = Value.de_json(data.get('min_'), client) data['max_'] = Value.de_json(data.get('max_'), 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.DiscreteScale`: Объект класса :class:`yandex_music.DiscreteScale`. """ if not data: return None data = super(DiscreteScale, cls).de_json(data, client) from yandex_music import Value data['min_'] = Value.de_json(data.get('min_'), client) data['max_'] = Value.de_json(data.get('max_'), client) return cls(client=client, **data)
def de_json(cls, data: dict, client: 'Client') -> Optional['Enum']: """Десериализация объекта. Args: data (:obj:`dict`): Поля и значения десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: :obj:`yandex_music.Enum`: Перечисление. """ if not data: return None data = super(Enum, cls).de_json(data, client) from yandex_music import Value data['possible_values'] = Value.de_list(data.get('possible_values'), client) return cls(client=client, **data)
def value(): return Value(TestValue.value, TestValue.name)
def test_de_json_all(self, client): json_dict = {'value': self.value, 'name': self.name} value = Value.de_json(json_dict, client) assert value.value == self.value assert value.name == self.name
def test_de_list_none(self, client): assert Value.de_list({}, client) == []
def test_de_json_none(self, client): assert Value.de_json({}, client) is None