test_custom_wave.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from yandex_music import CustomWave
  2. class TestCustomWave:
  3. title = 'В стиле: Трибунал'
  4. animation_url = 'https://music-custom-wave-media.s3.yandex.net/base.json'
  5. position = 'default'
  6. def test_expected_values(self, custom_wave):
  7. assert custom_wave.title == self.title
  8. assert custom_wave.animation_url == self.animation_url
  9. assert custom_wave.position == self.position
  10. def test_de_json_none(self, client):
  11. assert CustomWave.de_json({}, client) is None
  12. def test_de_json_required(self, client):
  13. json_dict = {
  14. 'title': self.title,
  15. 'animation_url': self.animation_url,
  16. 'position': self.position,
  17. }
  18. customwave = CustomWave.de_json(json_dict, client)
  19. assert customwave.title == self.title
  20. assert customwave.animation_url == self.animation_url
  21. assert customwave.position == self.position
  22. def test_de_json_all(self, client):
  23. json_dict = {
  24. 'title': self.title,
  25. 'animation_url': self.animation_url,
  26. 'position': self.position,
  27. }
  28. customwave = CustomWave.de_json(json_dict, client)
  29. assert customwave.title == self.title
  30. assert customwave.animation_url == self.animation_url
  31. assert customwave.position == self.position
  32. def test_equality(self):
  33. a = CustomWave(self.title, self.animation_url, self.position)
  34. b = CustomWave('', self.animation_url, self.position)
  35. c = CustomWave(self.title, self.animation_url, self.position)
  36. assert a != b
  37. assert hash(a) != hash(b)
  38. assert a is not b
  39. assert a == c