Merge pull request #288 from MarshalX/issue-249

Исправлено название поля с ссылкой на источник в классе Description
このコミットが含まれているのは:
Il'ya 2020-03-24 10:52:16 +03:00 committed by GitHub
コミット 4d60be188c
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
3個のファイルの変更16行の追加15行の削除

ファイルの表示

@ -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']: