-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
test_artist_event.py
54 lines (42 loc) · 1.85 KB
/
test_artist_event.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from yandex_music import ArtistEvent
class TestArtistEvent:
subscribed = True
def test_expected_values(self, artist_event, artist, track):
assert artist_event.artist == artist
assert artist_event.tracks == [track]
assert artist_event.similar_to_artists_from_history == [artist]
assert artist_event.subscribed == self.subscribed
def test_de_json_none(self, client):
assert ArtistEvent.de_json({}, client) is None
def test_de_list_none(self, client):
assert ArtistEvent.de_list([], client) == []
def test_de_json_required(self, client, artist, track):
json_dict = {
'artist': artist.to_dict(),
'tracks': [track.to_dict()],
'similar_to_artists_from_history': [artist.to_dict()],
}
artist_event = ArtistEvent.de_json(json_dict, client)
assert artist_event.artist == artist
assert artist_event.tracks == [track]
assert artist_event.similar_to_artists_from_history == [artist]
def test_de_json_all(self, client, artist, track):
json_dict = {
'artist': artist.to_dict(),
'tracks': [track.to_dict()],
'similar_to_artists_from_history': [artist.to_dict()],
'subscribed': self.subscribed,
}
artist_event = ArtistEvent.de_json(json_dict, client)
assert artist_event.artist == artist
assert artist_event.tracks == [track]
assert artist_event.similar_to_artists_from_history == [artist]
assert artist_event.subscribed == self.subscribed
def test_equality(self, artist, track):
a = ArtistEvent(artist, [track], [artist])
b = ArtistEvent(None, [track], [artist])
c = ArtistEvent(artist, [track], [artist])
assert a != b
assert hash(a) != hash(b)
assert a is not b
assert a == c