test_title.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from yandex_music import Title
  2. class TestTitle:
  3. title = 'Hammasi'
  4. full_title = 'Barcha janrlar musiqasi'
  5. def test_expected_values(self, title):
  6. assert title.title == self.title
  7. assert title.full_title == self.full_title
  8. def test_de_json_none(self, client):
  9. assert Title.de_json({}, client) is None
  10. def test_de_json_required(self, client):
  11. json_dict = {'title': self.title}
  12. title = Title.de_json(json_dict, client)
  13. assert title.title == self.title
  14. def test_de_json_all(self, client):
  15. json_dict = {'title': self.title, 'full_title': self.full_title}
  16. title = Title.de_json(json_dict, client)
  17. assert title.title == self.title
  18. assert title.full_title == self.full_title
  19. def test_equality(self):
  20. a = Title(self.title, self.full_title)
  21. b = Title('')
  22. c = Title(self.title, self.full_title)
  23. assert a != b
  24. assert hash(a) != hash(b)
  25. assert a is not b
  26. assert a == c