Skip to content

Commit

Permalink
Fix tests (#275)
Browse files Browse the repository at this point in the history
* Update lyrics in song tests

Lyrics got updated on Genius.

* Improve exception raises (flake8)
  • Loading branch information
allerter authored Dec 7, 2024
1 parent ee6c7fb commit 4671f04
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lyricsgenius/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def _make_request(
except Timeout as e:
error = "Request timed out:\n{e}".format(e=e)
if tries > self.retries:
raise Timeout(error)
raise Timeout(error) from e
except HTTPError as e:
error = get_description(e)
if response.status_code < 500 or tries > self.retries:
raise HTTPError(response.status_code, error)
raise HTTPError(response.status_code, error) from e

# Enforce rate limiting
time.sleep(self.sleep_time)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_genius.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def setUpClass(cls):
cls.lyrics_ending = (
"[Outro]"
"\nNow I’m kicking leaves"
"\nCursing the one that I love and the one I dont"
"\nI wonder who youre thinking of"
"\nCursing the one that I love and the one I don't"
"\nI wonder who you're thinking of"
)

def test_lyrics_with_url(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_song.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_artist(self):
self.assertEqual(self.song.artist, self.artist_name)

def test_lyrics_raw(self):
lyrics = '[Verse 1: Andy Shauf]'
lyrics = '[Verse 1]'
self.assertTrue(self.song.lyrics.startswith(lyrics))

def test_lyrics_no_section_headers(self):
Expand Down

0 comments on commit 4671f04

Please sign in to comment.