test_licence_text_part.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from yandex_music import LicenceTextPart
  2. class TestLicenceTextPart:
  3. text = 'Условия подписки.'
  4. url = 'https://yandex.ru/legal/yandex_plus_conditions/'
  5. def test_expected_values(self, licence_text_part):
  6. assert licence_text_part.text == self.text
  7. assert licence_text_part.url == self.url
  8. def test_de_json_none(self, client):
  9. assert LicenceTextPart.de_json({}, client) is None
  10. def test_de_list_none(self, client):
  11. assert LicenceTextPart.de_list([], client) == []
  12. def test_de_json_required(self, client):
  13. json_dict = {'text': self.text}
  14. licence_text_part = LicenceTextPart.de_json(json_dict, client)
  15. assert licence_text_part.text == self.text
  16. def test_de_json_all(self, client):
  17. json_dict = {'text': self.text, 'url': self.url}
  18. licence_text_part = LicenceTextPart.de_json(json_dict, client)
  19. assert licence_text_part.text == self.text
  20. assert licence_text_part.url == self.url
  21. def test_equality(self):
  22. a = LicenceTextPart(self.text, self.url)
  23. b = LicenceTextPart('', self.url)
  24. c = LicenceTextPart(self.text, self.url)
  25. assert a != b
  26. assert hash(a) != hash(b)
  27. assert a is not b
  28. assert a == c