mirror of https://github.com/scrapy/scrapy.git
Fix remaining issues in tests.
This commit is contained in:
parent
2e33fb812b
commit
afd5d85320
|
|
@ -14,7 +14,7 @@ spider = Spider("foo")
|
|||
|
||||
class TestHttpProxyMiddleware(TestCase):
|
||||
|
||||
failureException = AssertionError
|
||||
failureException = AssertionError # type: ignore[assignment]
|
||||
|
||||
def setUp(self):
|
||||
self._oldenv = os.environ.copy()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import shutil
|
|||
import string
|
||||
from ipaddress import IPv4Address
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from unittest import mock, skipIf
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ class GetDataHtmlLarge(LeafResource):
|
|||
class PostDataJsonMixin:
|
||||
@staticmethod
|
||||
def make_response(request: TxRequest, extra_data: str):
|
||||
assert request.content is not None
|
||||
response = {
|
||||
"request-headers": {},
|
||||
"request-body": json.loads(request.content.read()),
|
||||
|
|
@ -144,7 +146,8 @@ class QueryParams(LeafResource):
|
|||
request.setHeader("Content-Type", "application/json; charset=UTF-8")
|
||||
request.setHeader("Content-Encoding", "UTF-8")
|
||||
|
||||
query_params = {}
|
||||
query_params: Dict[str, str] = {}
|
||||
assert request.args is not None
|
||||
for k, v in request.args.items():
|
||||
query_params[str(k, "utf-8")] = str(v[0], "utf-8")
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ class BaseAsyncSpiderMiddlewareTestCase(SpiderMiddlewareTestCase):
|
|||
Should work for process_spider_output and, when it's supported, process_start_requests.
|
||||
"""
|
||||
|
||||
ITEM_TYPE: type
|
||||
RESULT_COUNT = 3 # to simplify checks, let everything return 3 objects
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Reference in New Issue