chore: refactor code quality issues (#2044)
This commit is contained in:
@@ -388,7 +388,7 @@ def test_bp_middleware_with_route(app):
|
||||
|
||||
def test_bp_middleware_order(app):
|
||||
blueprint = Blueprint("test_bp_middleware_order")
|
||||
order = list()
|
||||
order = []
|
||||
|
||||
@blueprint.middleware("request")
|
||||
def mw_1(request):
|
||||
|
||||
@@ -83,7 +83,7 @@ argv = dict(
|
||||
[
|
||||
(dict(port=42102, auto_reload=True), "script"),
|
||||
(dict(port=42103, debug=True), "module"),
|
||||
(dict(), "sanic"),
|
||||
({}, "sanic"),
|
||||
],
|
||||
)
|
||||
async def test_reloader_live(runargs, mode):
|
||||
|
||||
@@ -374,7 +374,7 @@ def test_file_head_response(app, file_name, static_file_directory):
|
||||
file_path = os.path.join(static_file_directory, filename)
|
||||
file_path = os.path.abspath(unquote(file_path))
|
||||
stats = await async_os.stat(file_path)
|
||||
headers = dict()
|
||||
headers = {}
|
||||
headers["Accept-Ranges"] = "bytes"
|
||||
headers["Content-Length"] = str(stats.st_size)
|
||||
if request.method == "HEAD":
|
||||
@@ -450,7 +450,7 @@ def test_file_stream_head_response(app, file_name, static_file_directory):
|
||||
async def file_route(request, filename):
|
||||
file_path = os.path.join(static_file_directory, filename)
|
||||
file_path = os.path.abspath(unquote(file_path))
|
||||
headers = dict()
|
||||
headers = {}
|
||||
headers["Accept-Ranges"] = "bytes"
|
||||
if request.method == "HEAD":
|
||||
# Return a normal HTTPResponse, not a
|
||||
|
||||
@@ -103,7 +103,7 @@ def test_static_file_bytes(app, static_file_directory, file_name):
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"file_name",
|
||||
[dict(), list(), object()],
|
||||
[{}, [], object()],
|
||||
)
|
||||
def test_static_file_invalid_path(app, static_file_directory, file_name):
|
||||
app.route("/")(lambda x: x)
|
||||
|
||||
@@ -2,7 +2,7 @@ import string
|
||||
|
||||
from urllib.parse import parse_qsl, urlsplit
|
||||
|
||||
import pytest as pytest
|
||||
import pytest
|
||||
|
||||
from sanic_testing.testing import HOST as test_host
|
||||
from sanic_testing.testing import PORT as test_port
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import pytest as pytest
|
||||
import pytest
|
||||
|
||||
from sanic.blueprints import Blueprint
|
||||
from sanic.constants import HTTP_METHODS
|
||||
|
||||
Reference in New Issue
Block a user