test_discrete_scale.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from yandex_music import DiscreteScale
  2. class TestDiscreteScale:
  3. type = 'discrete-scale'
  4. name = 'Настроение'
  5. def test_expected_values(self, discrete_scale, value):
  6. assert discrete_scale.type == self.type
  7. assert discrete_scale.name == self.name
  8. assert discrete_scale.min == value
  9. assert discrete_scale.max == value
  10. def test_de_json_none(self, client):
  11. assert DiscreteScale.de_json({}, client) is None
  12. def test_de_json_required(self, client, value):
  13. json_dict = {'type': self.type, 'name': self.name, 'min': value.to_dict(), 'max': value.to_dict()}
  14. discrete_scale = DiscreteScale.de_json(json_dict, client)
  15. assert discrete_scale.type == self.type
  16. assert discrete_scale.name == self.name
  17. assert discrete_scale.min == value
  18. assert discrete_scale.max == value
  19. def test_de_json_all(self, client, value):
  20. json_dict = {'type': self.type, 'name': self.name, 'min': value.to_dict(), 'max': value.to_dict()}
  21. discrete_scale = DiscreteScale.de_json(json_dict, client)
  22. assert discrete_scale.type == self.type
  23. assert discrete_scale.name == self.name
  24. assert discrete_scale.min == value
  25. assert discrete_scale.max == value
  26. def test_equality(self, value):
  27. a = DiscreteScale(self.type, self.name, value, value)
  28. b = DiscreteScale('', self.name, value, value)
  29. c = DiscreteScale('', '', value, value)
  30. d = DiscreteScale(self.type, self.name, value, value)
  31. assert a != b != c
  32. assert hash(a) != hash(b) != hash(c)
  33. assert a is not b is not c
  34. assert a == d