Run black and manually break up some text lines to correct linting

This commit is contained in:
Adam Hopkins 2019-06-04 13:26:05 +03:00
parent 0d9a21718f
commit 5f9e98554f

View File

@ -257,7 +257,7 @@ class SanicASGIAdapter(requests.asgi.ASGIAdapter):
return {"type": "http.request", "body": body_bytes} return {"type": "http.request", "body": body_bytes}
async def send(message) -> None: async def send(message) -> None:
nonlocal raw_kwargs, response_started, response_complete, template, context nonlocal raw_kwargs, response_started, response_complete, template, context # noqa
if message["type"] == "http.response.start": if message["type"] == "http.response.start":
assert ( assert (
@ -267,9 +267,10 @@ class SanicASGIAdapter(requests.asgi.ASGIAdapter):
raw_kwargs["headers"] = message["headers"] raw_kwargs["headers"] = message["headers"]
response_started = True response_started = True
elif message["type"] == "http.response.body": elif message["type"] == "http.response.body":
assert ( assert response_started, (
response_started 'Received "http.response.body" '
), 'Received "http.response.body" without "http.response.start".' 'without "http.response.start".'
)
assert ( assert (
not response_complete not response_complete
), 'Received "http.response.body" after response completed.' ), 'Received "http.response.body" after response completed.'
@ -327,7 +328,7 @@ async def app_call_with_return(self, scope, receive, send):
class SanicASGITestClient(requests.ASGISession): class SanicASGITestClient(requests.ASGISession):
def __init__( def __init__(
self, self,
app: "Sanic", app,
base_url: str = "http://{}".format(ASGI_HOST), base_url: str = "http://{}".format(ASGI_HOST),
suppress_exceptions: bool = False, suppress_exceptions: bool = False,
) -> None: ) -> None: