From 758f10c513c4f883524ab6df379061074865a99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Wed, 25 Oct 2023 00:32:27 +0100 Subject: [PATCH] ruff --fix --unsafe-fixes # Tests still A-OK! --- tests/test_blueprint_group.py | 2 +- tests/test_request_stream.py | 2 +- tests/test_requests.py | 2 +- tests/test_response.py | 6 +----- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_blueprint_group.py b/tests/test_blueprint_group.py index 330d5d9a..f36d5ee9 100644 --- a/tests/test_blueprint_group.py +++ b/tests/test_blueprint_group.py @@ -22,7 +22,7 @@ def test_bp_group_indexing(app: Sanic): group = Blueprint.group(blueprint_1, blueprint_2) assert group[0] == blueprint_1 - with raises(expected_exception=IndexError) as e: + with raises(expected_exception=IndexError): _ = group[3] diff --git a/tests/test_request_stream.py b/tests/test_request_stream.py index 1c21229d..279468d2 100644 --- a/tests/test_request_stream.py +++ b/tests/test_request_stream.py @@ -618,6 +618,6 @@ def test_streaming_echo(): assert res == b"-" res = await read_chunk() - assert res == None + assert res is None app.run(access_log=False, single_process=True) diff --git a/tests/test_requests.py b/tests/test_requests.py index d68b2dff..51dda4a0 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -2180,7 +2180,7 @@ def test_safe_method_with_body_ignored(app): ) assert request.body == b"" - assert request.json == None + assert request.json is None assert response.body == b"OK" diff --git a/tests/test_response.py b/tests/test_response.py index a158de57..d5257a75 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -610,7 +610,7 @@ def test_multiple_responses( @app.get("/4") async def handler4(request: Request): - response = await request.respond(headers={"one": "one"}) + await request.respond(headers={"one": "one"}) return json({"foo": "bar"}, headers={"one": "two"}) @app.get("/5") @@ -641,10 +641,6 @@ def test_multiple_responses( "been responded to." ) - error_msg3 = ( - "Response stream was ended, no more " - "response data is allowed to be sent." - ) with caplog.at_level(ERROR): _, response = app.test_client.get("/1")