test_value.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from yandex_music import Value
  2. class TestValue:
  3. value = 'not-russian'
  4. name = 'Иностранный'
  5. def test_expected_values(self, value):
  6. assert value.value == self.value
  7. assert value.name == self.name
  8. def test_de_json_none(self, client):
  9. assert Value.de_json({}, client) is None
  10. def test_de_list_none(self, client):
  11. assert Value.de_list([], client) == []
  12. def test_de_json_required(self, client):
  13. json_dict = {'value': self.value, 'name': self.name}
  14. value = Value.de_json(json_dict, client)
  15. assert value.value == self.value
  16. assert value.name == self.name
  17. def test_de_json_all(self, client):
  18. json_dict = {'value': self.value, 'name': self.name}
  19. value = Value.de_json(json_dict, client)
  20. assert value.value == self.value
  21. assert value.name == self.name
  22. def test_equality(self):
  23. a = Value(self.value, self.name)
  24. b = Value(self.value, '')
  25. c = Value(self.value, self.name)
  26. assert a != b
  27. assert hash(a) != hash(b)
  28. assert a is not b
  29. assert a == c