Scrapy, a fast high-level web crawling & scraping framework for Python.
Add tests for replace() with kwargs.
Andrey Rakhmatullina72394a388a8
diff --git a/tests_typing/test_http_request.mypy-testing b/tests_typing/test_http_request.mypy-testingindex 636e6895f..665db9088 100644--- a/tests_typing/test_http_request.mypy-testing+++ b/tests_typing/test_http_request.mypy-testing@@ -1,3 +1,5 @@+from typing import Any, Dict+import pytestfrom scrapy import Request@@ -33,6 +35,9 @@ def mypy_test_copy():req_copy = req.copy()reveal_type(req_copy) # R: scrapy.http.request.Request+[email protected]_testing+def mypy_test_copy_subclass():req = MyRequest("data:,")reveal_type(req) # R: __main__.MyRequestreq_copy = req.copy()@@ -45,13 +50,22 @@ def mypy_test_replace():reveal_type(req) # R: scrapy.http.request.Requestreq_copy = req.replace(body=b"a")reveal_type(req_copy) # R: scrapy.http.request.Request+ kwargs: Dict[str, Any] = {}+ req_copy2 = req.replace(body=b"a", **kwargs)+ reveal_type(req_copy2) # R: Any+[email protected]_testing+def mypy_test_replace_subclass():req = MyRequest("data:,")reveal_type(req) # R: __main__.MyRequestreq_copy = req.replace(body=b"a")reveal_type(req_copy) # R: __main__.MyRequestreq_copy2 = req.replace(body=b"a", cls=MyRequest2)reveal_type(req_copy2) # R: __main__.MyRequest2+ kwargs: Dict[str, Any] = {}+ req_copy3 = req.replace(body=b"a", cls=MyRequest2, **kwargs)+ reveal_type(req_copy3) # R: __main__.MyRequest2@pytest.mark.mypy_testingdiff --git a/tests_typing/test_http_response.mypy-testing b/tests_typing/test_http_response.mypy-testingindex 2e58b4fbc..d58ac1027 100644--- a/tests_typing/test_http_response.mypy-testing+++ b/tests_typing/test_http_response.mypy-testing@@ -1,3 +1,5 @@+from typing import Any, Dict+import pytestfrom scrapy.http import HtmlResponse, Response, TextResponse@@ -24,6 +26,9 @@ def mypy_test_copy():resp_copy = resp.copy()reveal_type(resp_copy) # R: scrapy.http.response.Response+[email protected]_testing+def mypy_test_copy_subclass():resp = HtmlResponse("data:,")reveal_type(resp) # R: scrapy.http.response.html.HtmlResponseresp_copy = resp.copy()@@ -36,10 +41,19 @@ def mypy_test_replace():reveal_type(resp) # R: scrapy.http.response.Responseresp_copy = resp.replace(body=b"a")reveal_type(resp_copy) # R: scrapy.http.response.Response+ kwargs: Dict[str, Any] = {}+ resp_copy2 = resp.replace(body=b"a", **kwargs)+ reveal_type(resp_copy2) # R: Any+[email protected]_testing+def mypy_test_replace_subclass():resp = HtmlResponse("data:,")reveal_type(resp) # R: scrapy.http.response.html.HtmlResponseresp_copy = resp.replace(body=b"a")reveal_type(resp_copy) # R: scrapy.http.response.html.HtmlResponseresp_copy2 = resp.replace(body=b"a", cls=TextResponse)reveal_type(resp_copy2) # R: scrapy.http.response.text.TextResponse+ kwargs: Dict[str, Any] = {}+ resp_copy3 = resp.replace(body=b"a", cls=TextResponse, **kwargs)+ reveal_type(resp_copy3) # R: scrapy.http.response.text.TextResponse