AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
remove dependency of unittest, use pytest
Itamar Friedman06f26cb29c69
diff --git a/tests/test_browse_scrape_text.py b/tests/test_browse_scrape_text.pyindex 1a08367e8d..27ebc0f693 100644--- a/tests/test_browse_scrape_text.py+++ b/tests/test_browse_scrape_text.py@@ -2,7 +2,6 @@# Generated by CodiumAIimport requests-from unittest.mock import Mockimport pytestfrom scripts.browse import scrape_text@@ -76,7 +75,7 @@ class TestScrapeText:# Tests that the function returns an error message when the response status code is an http error (>=400).def test_http_error(self, mocker):# Mock the requests.get() method to return a response with a 404 status code- mocker.patch('requests.get', return_value=Mock(status_code=404))+ mocker.patch('requests.get', return_value=mocker.Mock(status_code=404))# Call the function with a URLresult = scrape_text("https://www.example.com")@@ -85,15 +84,13 @@ class TestScrapeText:assert result == "Error: HTTP 404 error"# Tests that scrape_text() properly handles HTML tags.- def test_scrape_text_with_html_tags(self):+ def test_scrape_text_with_html_tags(self, mocker):# Create a mock response object with HTML containing tagshtml = "<html><body><p>This is <b>bold</b> text.</p></body></html>"- response = Mock()- response.status_code = 200- response.text = html-- # Mock the requests.get() method to return the mock response object- requests.get = Mock(return_value=response)+ mock_response = mocker.Mock()+ mock_response.status_code = 200+ mock_response.text = html+ mocker.patch("requests.get", return_value=mock_response)# Call the function with a URLresult = scrape_text("https://www.example.com")