test_lyrics_major.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from yandex_music import LyricsMajor
  2. class TestLyricsMajor:
  3. id = 560
  4. name = 'MUSIXMATCH'
  5. pretty_name = 'Musixmatch'
  6. def test_expected_values(self, lyrics_major):
  7. assert lyrics_major.id == self.id
  8. assert lyrics_major.name == self.name
  9. assert lyrics_major.pretty_name == self.pretty_name
  10. def test_de_json_none(self, client):
  11. assert LyricsMajor.de_json({}, client) is None
  12. def test_de_json_required(self, client):
  13. json_dict = {'id': self.id, 'name': self.name, 'pretty_name': self.pretty_name}
  14. lyrics_major = LyricsMajor.de_json(json_dict, client)
  15. assert lyrics_major.id == self.id
  16. assert lyrics_major.name == self.name
  17. assert lyrics_major.pretty_name == self.pretty_name
  18. def test_de_json_all(self, client):
  19. json_dict = {'id': self.id, 'name': self.name, 'pretty_name': self.pretty_name}
  20. lyrics_major = LyricsMajor.de_json(json_dict, client)
  21. assert lyrics_major.id == self.id
  22. assert lyrics_major.name == self.name
  23. assert lyrics_major.pretty_name == self.pretty_name
  24. def test_equality(self):
  25. a = LyricsMajor(self.id, self.name, self.pretty_name)
  26. b = LyricsMajor(10, self.name, self.pretty_name)
  27. c = LyricsMajor(self.id, self.name, self.pretty_name)
  28. assert a != b
  29. assert hash(a) != hash(b)
  30. assert a is not b
  31. assert a == c