diff --git a/tests/unit/test_browse_scrape_text.py b/tests/unit/test_browse_scrape_text.py index 1a36e19b5d8f..69e0c0d43203 100644 --- a/tests/unit/test_browse_scrape_text.py +++ b/tests/unit/test_browse_scrape_text.py @@ -41,6 +41,7 @@ class TestScrapeText: + """Tests for the scrape_text function.""" # Tests that scrape_text() returns the expected text when given a valid URL. def test_scrape_text_with_valid_url(self, mocker): # Mock the requests.get() method to return a response with expected text @@ -61,6 +62,7 @@ def test_scrape_text_with_valid_url(self, mocker): # Tests that the function returns an error message when an invalid or unreachable # url is provided. def test_invalid_url(self, mocker): + """Test that the function returns an error message when an invalid or unreachable url is provided.""" # Mock the requests.get() method to raise an exception mocker.patch( "requests.Session.get", side_effect=requests.exceptions.RequestException @@ -75,6 +77,7 @@ def test_invalid_url(self, mocker): # Tests that the function returns an empty string when the html page contains no # text to be scraped. def test_no_text(self, mocker): + """"Test that the function returns an empty string when the html page contains no text to be scraped.""" # Mock the requests.get() method to return a response with no text mock_response = mocker.Mock() mock_response.status_code = 200 @@ -88,6 +91,7 @@ def test_no_text(self, mocker): # Tests that the function returns an error message when the response status code is # an http error (>=400). def test_http_error(self, mocker): + """Test that the function returns an error message when the response status code is an http error (>=400).""" # Mock the requests.get() method to return a response with a 404 status code mocker.patch("requests.Session.get", return_value=mocker.Mock(status_code=404)) @@ -99,6 +103,7 @@ def test_http_error(self, mocker): # Tests that scrape_text() properly handles HTML tags. def test_scrape_text_with_html_tags(self, mocker): + """Test that scrape_text() properly handles HTML tags.""" # Create a mock response object with HTML containing tags html = "
This is bold text.
" mock_response = mocker.Mock()