Исправлено название поля с ссылкой на источник в классе Description
このコミットが含まれているのは:
コミット
4d60be188c
|
@ -217,7 +217,7 @@ def counts():
|
|||
|
||||
@pytest.fixture(scope='session')
|
||||
def description():
|
||||
return Description(TestDescription.text, TestDescription.url)
|
||||
return Description(TestDescription.text, TestDescription.uri)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
|
|
|
@ -5,34 +5,34 @@ class TestDescription:
|
|||
text = 'Американский певец и актёр, один из самых коммерчески успешных исполнителей популярной музыки XX века. ' \
|
||||
'Также известен как «король рок-н-ролла». Пресли популяризовал рок-н-ролл, хотя и не был первым ' \
|
||||
'исполнителем этого жанра. '
|
||||
url = 'http://ru.wikipedia.org/wiki/Пресли, Элвис'
|
||||
uri = 'http://ru.wikipedia.org/wiki/Пресли, Элвис'
|
||||
|
||||
def test_expected_values(self, description):
|
||||
assert description.text == self.text
|
||||
assert description.url == self.url
|
||||
assert description.uri == self.uri
|
||||
|
||||
def test_de_json_none(self, client):
|
||||
assert Description.de_json({}, client) is None
|
||||
|
||||
def test_de_json_required(self, client):
|
||||
json_dict = {'text': self.text, 'url': self.url}
|
||||
json_dict = {'text': self.text, 'uri': self.uri}
|
||||
description = Description.de_json(json_dict, client)
|
||||
|
||||
assert description.text == self.text
|
||||
assert description.url == self.url
|
||||
assert description.uri == self.uri
|
||||
|
||||
def test_de_json_all(self, client):
|
||||
json_dict = {'text': self.text, 'url': self.url}
|
||||
json_dict = {'text': self.text, 'uri': self.uri}
|
||||
description = Description.de_json(json_dict, client)
|
||||
|
||||
assert description.text == self.text
|
||||
assert description.url == self.url
|
||||
assert description.uri == self.uri
|
||||
|
||||
def test_equality(self):
|
||||
a = Description(self.text, self.url)
|
||||
b = Description('', self.url)
|
||||
a = Description(self.text, self.uri)
|
||||
b = Description('', self.uri)
|
||||
c = Description(self.text, '')
|
||||
d = Description(self.text, self.url)
|
||||
d = Description(self.text, self.uri)
|
||||
|
||||
assert a != b != c
|
||||
assert hash(a) != hash(b) != hash(c)
|
||||
|
|
|
@ -15,26 +15,27 @@ class Description(YandexMusicObject):
|
|||
|
||||
Attributes:
|
||||
text (:obj:`str`): Описание исполнителя.
|
||||
url (:obj:`str`): Ссылка на источник.
|
||||
uri (:obj:`str`): Ссылка на источник.
|
||||
client (:obj:`yandex_music.Client`): Клиент Yandex Music.
|
||||
|
||||
Args:
|
||||
text (:obj:`str`): Описание исполнителя.
|
||||
url (:obj:`str`): Ссылка на источник.
|
||||
uri (:obj:`str`): Ссылка на источник.
|
||||
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
||||
**kwargs: Произвольные ключевые аргументы полученные от API.
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
text: str,
|
||||
url: str,
|
||||
uri: str,
|
||||
client: Optional['Client'] = None,
|
||||
**kwargs) -> None:
|
||||
self.text = text
|
||||
self.url = url
|
||||
|
||||
self.uri = uri
|
||||
|
||||
self.client = client
|
||||
self._id_attrs = (self.text, self.url)
|
||||
self._id_attrs = (self.text, self.uri)
|
||||
|
||||
@classmethod
|
||||
def de_json(cls, data: dict, client: 'Client') -> Optional['Description']:
|
||||
|
|
読み込み中…
新しいイシューから参照