Хотфкис. Поле picture в vinyl может быть None
このコミットが含まれているのは:
コミット
4389e943e7
|
@ -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
|
||||
|
|
読み込み中…
新しいイシューから参照