-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
test_icon.py
39 lines (28 loc) · 1.32 KB
/
test_icon.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
from yandex_music import Icon
class TestIcon:
background_color = '#ff6665'
image_url = 'avatars.yandex.net/get-music-misc/34161/rotor-genre-pop-icon/%%'
def test_expected_values(self, icon):
assert icon.background_color == self.background_color
assert icon.image_url == self.image_url
def test_de_json_none(self, client):
assert Icon.de_json({}, client) is None
def test_de_json_required(self, client):
json_dict = {'background_color': self.background_color, 'image_url': self.image_url}
icon = Icon.de_json(json_dict, client)
assert icon.background_color == self.background_color
assert icon.image_url == self.image_url
def test_de_json_all(self, client):
json_dict = {'background_color': self.background_color, 'image_url': self.image_url}
icon = Icon.de_json(json_dict, client)
assert icon.background_color == self.background_color
assert icon.image_url == self.image_url
def test_equality(self):
a = Icon(self.background_color, self.image_url)
b = Icon('#000000', self.image_url)
c = Icon(self.background_color, '')
d = Icon(self.background_color, self.image_url)
assert a != b != c
assert hash(a) != hash(b) != hash(c)
assert a is not b is not c
assert a == d