test_shot_type.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from yandex_music import ShotType
  2. class TestShotType:
  3. id = 'alice'
  4. title = 'Шот от Алисы'
  5. def test_expected_values(self, shot_type):
  6. assert shot_type.id == self.id
  7. assert shot_type.title == self.title
  8. def test_de_json_none(self, client):
  9. assert ShotType.de_json({}, client) is None
  10. def test_de_json_required(self, client):
  11. json_dict = {'id': self.id, 'title': self.title}
  12. shot_type = ShotType.de_json(json_dict, client)
  13. assert shot_type.id == self.id
  14. assert shot_type.title == self.title
  15. def test_de_json_all(self, client):
  16. json_dict = {'id': self.id, 'title': self.title}
  17. shot_type = ShotType.de_json(json_dict, client)
  18. assert shot_type.id == self.id
  19. assert shot_type.title == self.title
  20. def test_equality(self):
  21. a = ShotType(self.id, self.title)
  22. b = ShotType('', self.title)
  23. c = ShotType(self.id, '')
  24. d = ShotType('', '')
  25. e = ShotType(self.id, self.title)
  26. assert a != b != c != d != e
  27. assert hash(a) != hash(b) != hash(c) != hash(d) != hash(e)
  28. assert a is not b is not c is not d is not e
  29. assert a == e
  30. assert hash(a) == hash(e)