test_track_with_ads.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from yandex_music import TrackWithAds
  2. class TestTrackWithAds:
  3. type = 'track'
  4. def test_expected_values(self, track_with_ads, track):
  5. assert track_with_ads.type == self.type
  6. assert track_with_ads.track == track
  7. def test_de_json_none(self, client):
  8. assert TrackWithAds.de_json({}, client) is None
  9. def test_de_list_none(self, client):
  10. assert TrackWithAds.de_list([], client) == []
  11. def test_de_json_required(self, client, track):
  12. json_dict = {'type': self.type, 'track': track.to_dict()}
  13. track_with_ads = TrackWithAds.de_json(json_dict, client)
  14. assert track_with_ads.type == self.type
  15. assert track_with_ads.track == track
  16. def test_de_json_all(self, client, track):
  17. json_dict = {'type': self.type, 'track': track.to_dict()}
  18. track_with_ads = TrackWithAds.de_json(json_dict, client)
  19. assert track_with_ads.type == self.type
  20. assert track_with_ads.track == track
  21. def test_equality(self, track):
  22. a = TrackWithAds(self.type, track)
  23. b = TrackWithAds('', track)
  24. c = TrackWithAds(self.type, track)
  25. assert a != b
  26. assert hash(a) != hash(b)
  27. assert a is not b
  28. assert a == c