Fix tests

This commit is contained in:
Ritiek Malhotra
2019-07-20 21:49:25 +05:30
parent 5ca4317944
commit 69522331df
3 changed files with 4 additions and 4 deletions

View File

@@ -258,7 +258,7 @@ def remove_duplicates(tracks):
def content_available(url):
try:
response = urllib.request.urlopen(url)
except HTTPError:
except urllib.request.HTTPError:
return False
else:
return response.getcode() < 300

View File

@@ -23,12 +23,12 @@ class TestMethodCalls:
def test_pafy_getbestthumb(self, content_fixture):
thumbnail = patcher._getbestthumb(content_fixture)
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/maxresdefault.jpg"
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/hqdefault.jpg"
def test_pafy_getbestthumb_without_ytdl(self, content_fixture):
content_fixture._ydl_info["thumbnails"][0]["url"] = None
thumbnail = patcher._getbestthumb(content_fixture)
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/maxresdefault.jpg"
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/sddefault.jpg"
def test_pafy_content_available(self):

View File

@@ -141,7 +141,7 @@ class TestFetchAlbumsFromArtist:
return albums
def test_len(self, albums_from_artist_fixture):
assert len(albums_from_artist_fixture) == 53
assert len(albums_from_artist_fixture) == 54
def test_zeroth_album_name(self, albums_from_artist_fixture):
assert albums_from_artist_fixture[0]["name"] == "Revolution Radio"