forked from orbit-oss/flask
Fix style issues on master using Black
This commit is contained in:
parent
2c68f86336
commit
a5ff3cd01b
4 changed files with 19 additions and 14 deletions
|
|
@ -660,9 +660,11 @@ def show_server_banner(env, debug, app_import_path, eager_loading):
|
||||||
|
|
||||||
if env == "production":
|
if env == "production":
|
||||||
click.secho(
|
click.secho(
|
||||||
' WARNING: This is a development server. '
|
" WARNING: This is a development server. "
|
||||||
'Do not use it in a production deployment.', fg='red')
|
"Do not use it in a production deployment.",
|
||||||
click.secho(' Use a production WSGI server instead.', dim=True)
|
fg="red",
|
||||||
|
)
|
||||||
|
click.secho(" Use a production WSGI server instead.", dim=True)
|
||||||
|
|
||||||
if debug is not None:
|
if debug is not None:
|
||||||
click.echo(" * Debug mode: {0}".format("on" if debug else "off"))
|
click.echo(" * Debug mode: {0}".format("on" if debug else "off"))
|
||||||
|
|
|
||||||
|
|
@ -1147,12 +1147,12 @@ def test_response_types(app, client):
|
||||||
def from_wsgi():
|
def from_wsgi():
|
||||||
return NotFound()
|
return NotFound()
|
||||||
|
|
||||||
@app.route('/dict')
|
@app.route("/dict")
|
||||||
def from_dict():
|
def from_dict():
|
||||||
return {"foo": "bar"}, 201
|
return {"foo": "bar"}, 201
|
||||||
|
|
||||||
assert client.get('/text').data == u'Hällo Wörld'.encode('utf-8')
|
assert client.get("/text").data == u"Hällo Wörld".encode("utf-8")
|
||||||
assert client.get('/bytes').data == u'Hällo Wörld'.encode('utf-8')
|
assert client.get("/bytes").data == u"Hällo Wörld".encode("utf-8")
|
||||||
|
|
||||||
rv = client.get("/full_tuple")
|
rv = client.get("/full_tuple")
|
||||||
assert rv.data == b"Meh"
|
assert rv.data == b"Meh"
|
||||||
|
|
@ -1185,7 +1185,7 @@ def test_response_types(app, client):
|
||||||
assert b"Not Found" in rv.data
|
assert b"Not Found" in rv.data
|
||||||
assert rv.status_code == 404
|
assert rv.status_code == 404
|
||||||
|
|
||||||
rv = client.get('/dict')
|
rv = client.get("/dict")
|
||||||
assert rv.json == {"foo": "bar"}
|
assert rv.json == {"foo": "bar"}
|
||||||
assert rv.status_code == 201
|
assert rv.status_code == 201
|
||||||
|
|
||||||
|
|
@ -1301,11 +1301,13 @@ def test_jsonify_mimetype(app, req_ctx):
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7")
|
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7")
|
||||||
def test_json_dump_dataclass(app, req_ctx):
|
def test_json_dump_dataclass(app, req_ctx):
|
||||||
from dataclasses import make_dataclass
|
from dataclasses import make_dataclass
|
||||||
|
|
||||||
Data = make_dataclass("Data", [("name", str)])
|
Data = make_dataclass("Data", [("name", str)])
|
||||||
value = flask.json.dumps(Data("Flask"), app=app)
|
value = flask.json.dumps(Data("Flask"), app=app)
|
||||||
value = flask.json.loads(value, app=app)
|
value = flask.json.loads(value, app=app)
|
||||||
assert value == {"name": "Flask"}
|
assert value == {"name": "Flask"}
|
||||||
|
|
||||||
|
|
||||||
def test_jsonify_args_and_kwargs_check(app, req_ctx):
|
def test_jsonify_args_and_kwargs_check(app, req_ctx):
|
||||||
with pytest.raises(TypeError) as e:
|
with pytest.raises(TypeError) as e:
|
||||||
flask.jsonify("fake args", kwargs="fake")
|
flask.jsonify("fake args", kwargs="fake")
|
||||||
|
|
@ -1428,15 +1430,15 @@ def test_static_url_path_with_ending_slash():
|
||||||
|
|
||||||
|
|
||||||
def test_static_url_empty_path(app):
|
def test_static_url_empty_path(app):
|
||||||
app = flask.Flask(__name__, static_folder='', static_url_path='')
|
app = flask.Flask(__name__, static_folder="", static_url_path="")
|
||||||
rv = app.test_client().open('/static/index.html', method='GET')
|
rv = app.test_client().open("/static/index.html", method="GET")
|
||||||
assert rv.status_code == 200
|
assert rv.status_code == 200
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
|
|
||||||
def test_static_url_empty_path_default(app):
|
def test_static_url_empty_path_default(app):
|
||||||
app = flask.Flask(__name__, static_folder='')
|
app = flask.Flask(__name__, static_folder="")
|
||||||
rv = app.test_client().open('/static/index.html', method='GET')
|
rv = app.test_client().open("/static/index.html", method="GET")
|
||||||
assert rv.status_code == 200
|
assert rv.status_code == 200
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
|
|
@ -1949,7 +1951,9 @@ def test_run_server_port(monkeypatch, app):
|
||||||
(None, None, "localhost:0", "localhost", 0),
|
(None, None, "localhost:0", "localhost", 0),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_run_from_config(monkeypatch, host, port, server_name, expect_host, expect_port, app):
|
def test_run_from_config(
|
||||||
|
monkeypatch, host, port, server_name, expect_host, expect_port, app
|
||||||
|
):
|
||||||
def run_simple_mock(hostname, port, *args, **kwargs):
|
def run_simple_mock(hostname, port, *args, **kwargs):
|
||||||
assert hostname == expect_host
|
assert hostname == expect_host
|
||||||
assert port == expect_port
|
assert port == expect_port
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ def test_load_dotenv(monkeypatch):
|
||||||
assert os.environ["EGGS"] == "3"
|
assert os.environ["EGGS"] == "3"
|
||||||
|
|
||||||
# Non existent file should not load
|
# Non existent file should not load
|
||||||
assert not load_dotenv('non-existent-file')
|
assert not load_dotenv("non-existent-file")
|
||||||
|
|
||||||
|
|
||||||
@need_dotenv
|
@need_dotenv
|
||||||
|
|
|
||||||
|
|
@ -976,7 +976,6 @@ class TestSafeJoin(object):
|
||||||
print(flask.safe_join(*args))
|
print(flask.safe_join(*args))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestHelpers(object):
|
class TestHelpers(object):
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"debug, expected_flag, expected_default_flag",
|
"debug, expected_flag, expected_default_flag",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue