def test_equality(self):
        a = CaseForms(self.nominative, self.genitive, self.dative,
                      self.accusative, self.instrumental, self.prepositional)
        b = CaseForms(self.nominative, '', self.dative, self.accusative,
                      self.instrumental, self.prepositional)
        c = CaseForms(self.nominative, self.genitive, self.dative,
                      self.accusative, self.instrumental, self.prepositional)

        assert a != b
        assert hash(a) != hash(b)
        assert a is not b

        assert a == c
예제 #2
0
def case_forms():
    return CaseForms(
        TestCaseForms.nominative,
        TestCaseForms.genitive,
        TestCaseForms.dative,
        TestCaseForms.accusative,
        TestCaseForms.instrumental,
        TestCaseForms.prepositional,
    )
    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
예제 #5
0
    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)
예제 #6
0
    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