Merge pull request #184 from MarshalX/hotfix

Хотфкис. Поле picture в vinyl может быть None
このコミットが含まれているのは:
Il'ya 2020-01-19 05:13:34 +03:00 committed by GitHub
コミット 0685936064
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
3個のファイルの変更6行の追加8行の削除

ファイルの表示

@ -162,7 +162,7 @@ def video():
@pytest.fixture(scope='session')
def vinyl():
return Vinyl(TestVinyl.url, TestVinyl.picture, TestVinyl.title, TestVinyl.year, TestVinyl.price, TestVinyl.media)
return Vinyl(TestVinyl.url, TestVinyl.title, TestVinyl.year, TestVinyl.price, TestVinyl.media, TestVinyl.picture)
@pytest.fixture(scope='session')

ファイルの表示

@ -24,12 +24,10 @@ class TestVinyl:
assert Vinyl.de_list({}, client) == []
def test_de_json_required(self, client):
json_dict = {'url': self.url, 'picture': self.picture, 'title': self.title, 'year': self.year,
'price': self.price, 'media': self.media}
json_dict = {'url': self.url, 'title': self.title, 'year': self.year, 'price': self.price, 'media': self.media}
vinyl = Vinyl.de_json(json_dict, client)
assert vinyl.url == self.url
assert vinyl.picture == self.picture
assert vinyl.title == self.title
assert vinyl.year == self.year
assert vinyl.price == self.price
@ -48,9 +46,9 @@ class TestVinyl:
assert vinyl.media == self.media
def test_equality(self):
a = Vinyl(self.url, self.picture, self.title, 2020, 200, self.media)
b = Vinyl(self.url, self.picture, self.title, self.year, self.price, self.media)
c = Vinyl(self.url, self.picture, self.title, self.year, self.price, self.media)
a = Vinyl(self.url, self.title, 2020, 200, self.media, self.picture)
b = Vinyl(self.url, self.title, self.year, self.price, self.media, self.picture)
c = Vinyl(self.url, self.title, self.year, self.price, self.media, self.picture)
assert a != b
assert hash(a) != hash(b)

ファイルの表示

@ -9,11 +9,11 @@ from yandex_music import YandexMusicObject
class Vinyl(YandexMusicObject):
def __init__(self,
url: str,
picture: str,
title: str,
year: int,
price: int,
media: str,
picture: Optional[str] = None,
client: Optional['Client'] = None,
**kwargs) -> None:
self.url = url