2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import Title
|
|
|
|
|
|
|
|
|
|
|
|
class TestTitle:
|
2019-11-08 04:52:26 +09:00
|
|
|
title = 'Hammasi'
|
|
|
|
full_title = 'Barcha janrlar musiqasi'
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, title):
|
|
|
|
assert title.title == self.title
|
|
|
|
assert title.full_title == self.full_title
|
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert Title.de_json({}, client) is None
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client):
|
|
|
|
json_dict = {'title': self.title}
|
|
|
|
title = Title.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert title.title == self.title
|
|
|
|
|
|
|
|
def test_de_json_all(self, client):
|
|
|
|
json_dict = {'title': self.title, 'full_title': self.full_title}
|
|
|
|
title = Title.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert title.title == self.title
|
|
|
|
assert title.full_title == self.full_title
|
|
|
|
|
|
|
|
def test_equality(self):
|
2019-11-08 04:52:26 +09:00
|
|
|
a = Title(self.title, self.full_title)
|
|
|
|
b = Title('')
|
2019-11-10 03:11:43 +09:00
|
|
|
c = Title(self.title, self.full_title)
|
2019-11-08 04:52:26 +09:00
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|