fix: fix return value
Some checks are pending
Python application test / build (pull_request) Waiting to run
Some checks are pending
Python application test / build (pull_request) Waiting to run
This commit is contained in:
@@ -21,7 +21,7 @@ class TestWebScrapingAndReporting(unittest.TestCase):
|
|||||||
def test_fetch_html_failure(self):
|
def test_fetch_html_failure(self):
|
||||||
"""测试fetch_html在请求失败时返回None。"""
|
"""测试fetch_html在请求失败时返回None。"""
|
||||||
with patch("requests.get") as mocked_get:
|
with patch("requests.get") as mocked_get:
|
||||||
mocked_get.return_code.status_code = 404
|
mocked_get.return_value.status_code = 404
|
||||||
url = "http://example.com"
|
url = "http://example.com"
|
||||||
result = fetch_html(url)
|
result = fetch_html(url)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user