test_album_event.py 1.3 KB

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