Хотфкис. Поле picture в vinyl может быть None
このコミットが含まれているのは:
コミット
0685936064
|
@ -162,7 +162,7 @@ def video():
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def vinyl():
|
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')
|
@pytest.fixture(scope='session')
|
||||||
|
|
|
@ -24,12 +24,10 @@ class TestVinyl:
|
||||||
assert Vinyl.de_list({}, client) == []
|
assert Vinyl.de_list({}, client) == []
|
||||||
|
|
||||||
def test_de_json_required(self, client):
|
def test_de_json_required(self, client):
|
||||||
json_dict = {'url': self.url, 'picture': self.picture, 'title': self.title, 'year': self.year,
|
json_dict = {'url': self.url, 'title': self.title, 'year': self.year, 'price': self.price, 'media': self.media}
|
||||||
'price': self.price, 'media': self.media}
|
|
||||||
vinyl = Vinyl.de_json(json_dict, client)
|
vinyl = Vinyl.de_json(json_dict, client)
|
||||||
|
|
||||||
assert vinyl.url == self.url
|
assert vinyl.url == self.url
|
||||||
assert vinyl.picture == self.picture
|
|
||||||
assert vinyl.title == self.title
|
assert vinyl.title == self.title
|
||||||
assert vinyl.year == self.year
|
assert vinyl.year == self.year
|
||||||
assert vinyl.price == self.price
|
assert vinyl.price == self.price
|
||||||
|
@ -48,9 +46,9 @@ class TestVinyl:
|
||||||
assert vinyl.media == self.media
|
assert vinyl.media == self.media
|
||||||
|
|
||||||
def test_equality(self):
|
def test_equality(self):
|
||||||
a = Vinyl(self.url, self.picture, self.title, 2020, 200, self.media)
|
a = Vinyl(self.url, self.title, 2020, 200, self.media, self.picture)
|
||||||
b = Vinyl(self.url, self.picture, self.title, self.year, self.price, self.media)
|
b = Vinyl(self.url, self.title, self.year, self.price, self.media, self.picture)
|
||||||
c = Vinyl(self.url, self.picture, self.title, self.year, self.price, self.media)
|
c = Vinyl(self.url, self.title, self.year, self.price, self.media, self.picture)
|
||||||
|
|
||||||
assert a != b
|
assert a != b
|
||||||
assert hash(a) != hash(b)
|
assert hash(a) != hash(b)
|
||||||
|
|
|
@ -9,11 +9,11 @@ from yandex_music import YandexMusicObject
|
||||||
class Vinyl(YandexMusicObject):
|
class Vinyl(YandexMusicObject):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
url: str,
|
url: str,
|
||||||
picture: str,
|
|
||||||
title: str,
|
title: str,
|
||||||
year: int,
|
year: int,
|
||||||
price: int,
|
price: int,
|
||||||
media: str,
|
media: str,
|
||||||
|
picture: Optional[str] = None,
|
||||||
client: Optional['Client'] = None,
|
client: Optional['Client'] = None,
|
||||||
**kwargs) -> None:
|
**kwargs) -> None:
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
読み込み中…
新しいイシューから参照