Add test for lyrics

This commit is contained in:
Serene-Arc 2024-07-11 15:15:25 +10:00
parent bdf9eb2a26
commit 30106d105c
No known key found for this signature in database
GPG key ID: 3533EF9B9AD01CA9
2 changed files with 1154 additions and 1 deletions

View file

@ -492,7 +492,17 @@ class GeniusScrapeLyricsFromHtmlTest(GeniusBaseTest):
"""Ensure we are able to scrape a page with lyrics"""
url = "https://genius.com/Ttng-chinchilla-lyrics"
mock = MockFetchUrl()
self.assertIsNotNone(genius._scrape_lyrics_from_html(mock(url)))
lyrics = genius._scrape_lyrics_from_html(mock(url))
self.assertIsNotNone(lyrics)
self.assertEqual(lyrics.count("\n"), 28)
def test_good_lyrics_multiple_divs(self):
"""Ensure we are able to scrape a page with lyrics"""
url = "https://genius.com/2pac-all-eyez-on-me-lyrics"
mock = MockFetchUrl()
lyrics = genius._scrape_lyrics_from_html(mock(url))
self.assertIsNotNone(lyrics)
self.assertEqual(lyrics.count("\n"), 133)
# TODO: find an example of a lyrics page with multiple divs and test it

File diff suppressed because one or more lines are too long