test_playlist_id.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from yandex_music import PlaylistId
  2. class TestPlaylistId:
  3. uid = 460142547
  4. kind = 5332052
  5. def test_expected_values(self, playlist_id):
  6. assert playlist_id.uid == self.uid
  7. assert playlist_id.kind == self.kind
  8. def test_de_json_none(self, client):
  9. assert PlaylistId.de_json({}, client) is None
  10. def test_de_list_none(self, client):
  11. assert PlaylistId.de_list([], client) == []
  12. def test_de_json_required(self, client):
  13. json_dict = {'uid': self.uid, 'kind': self.kind}
  14. playlist_id = PlaylistId.de_json(json_dict, client)
  15. assert playlist_id.uid == self.uid
  16. assert playlist_id.kind == self.kind
  17. def test_de_json_all(self, client):
  18. json_dict = {'uid': self.uid, 'kind': self.kind}
  19. playlist_id = PlaylistId.de_json(json_dict, client)
  20. assert playlist_id.uid == self.uid
  21. assert playlist_id.kind == self.kind
  22. def test_equality(self):
  23. a = PlaylistId(self.uid, self.kind)
  24. b = PlaylistId(self.uid, 10)
  25. c = PlaylistId(10, self.kind)
  26. d = PlaylistId(self.uid, self.kind)
  27. assert a != b != c
  28. assert hash(a) != hash(b) != hash(c)
  29. assert a is not b is not c
  30. assert a == d