test_label.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from yandex_music import Label
  2. class TestLabel:
  3. id = 148217
  4. name = 'tommee profitt STUDIOS'
  5. another_representation_of_label = 'NoCopyrightSounds'
  6. def test_expected_values(self, label):
  7. if isinstance(label, str):
  8. assert label == self.another_representation_of_label
  9. else:
  10. assert label.id == self.id
  11. assert label.name == self.name
  12. def test_de_list_none(self, client):
  13. assert Label.de_list([], client) == []
  14. def test_de_json_none(self, client):
  15. assert Label.de_json({}, client) is None
  16. def test_de_json_required(self, client):
  17. json_dict = {'id': self.id, 'name': self.name}
  18. label = Label.de_json(json_dict, client)
  19. assert label.id == self.id
  20. assert label.name == self.name
  21. def test_de_json_all(self, client):
  22. json_dict = {'id': self.id, 'name': self.name}
  23. label = Label.de_json(json_dict, client)
  24. assert label.id == self.id
  25. assert label.name == self.name
  26. def test_equality(self):
  27. a = Label(self.id, self.name)
  28. b = Label(10, self.name)
  29. c = Label(self.id, '')
  30. d = Label(self.id, self.name)
  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