Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 5
0
    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
Esempio n. 6
0
 def test_de_json_none(self, client):
     assert Value.de_json({}, client) is None