test_track_id.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from yandex_music import TrackId
  2. class TestTrackId:
  3. id = 74340
  4. track_id = 49947064
  5. album_id = 7025
  6. from_ = 'web-home_new-auto-playlist_of_the_day-playlist-main'
  7. def test_expected_values(self, track_id):
  8. assert track_id.id == self.id
  9. assert track_id.track_id == self.track_id
  10. assert track_id.album_id == self.album_id
  11. assert track_id.from_ == self.from_
  12. def test_de_json_none(self, client):
  13. assert TrackId.de_json({}, client) is None
  14. def test_de_list_none(self, client):
  15. assert TrackId.de_list([], client) == []
  16. def test_de_json_all(self, client):
  17. json_dict = {'id': self.id, 'track_id': self.track_id, 'album_id': self.album_id, 'from_': self.from_}
  18. track_id = TrackId.de_json(json_dict, client)
  19. assert track_id.id == self.id
  20. assert track_id.track_id == self.track_id
  21. assert track_id.album_id == self.album_id
  22. assert track_id.from_ == self.from_
  23. def test_equality(self):
  24. a = TrackId(self.id, self.album_id)
  25. b = TrackId(10, self.album_id)
  26. c = TrackId(self.id, self.album_id)
  27. assert a != b
  28. assert hash(a) != hash(b)
  29. assert a is not b
  30. assert a == c