mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-29 21:31:23 +00:00
Refactor exceptions
* Suffix names for custom exceptions with "Error" * Introduce exceptions for when the coressponding encoder isn't found
This commit is contained in:
@@ -33,5 +33,5 @@ class TestGenius:
|
||||
raise urllib.request.HTTPError("", "", "", "", "")
|
||||
|
||||
monkeypatch.setattr("urllib.request.urlopen", mocked_urlopen)
|
||||
with pytest.raises(exceptions.LyricsNotFound):
|
||||
with pytest.raises(exceptions.LyricsNotFoundError):
|
||||
track.get_lyrics()
|
||||
|
||||
@@ -25,11 +25,11 @@ class TestLyricWikia:
|
||||
def lyricwikia_lyrics_not_found(msg):
|
||||
raise lyricwikia.LyricsNotFound(msg)
|
||||
|
||||
# Wrap `lyricwikia.LyricsNotFound` with `exceptions.LyricsNotFound` error.
|
||||
# Wrap `lyricwikia.LyricsNotFoundError` with `exceptions.LyricsNotFoundError` error.
|
||||
monkeypatch.setattr(
|
||||
"lyricwikia.get_lyrics",
|
||||
lambda a, b, c, d: lyricwikia_lyrics_not_found("Nope, no lyrics."),
|
||||
)
|
||||
track = LyricWikia("Lyricwikia", "Lyricwikia")
|
||||
with pytest.raises(exceptions.LyricsNotFound):
|
||||
with pytest.raises(exceptions.LyricsNotFoundError):
|
||||
track.get_lyrics()
|
||||
|
||||
Reference in New Issue
Block a user