From a5ff3cd01b8a78b5ed2961a8095290fed4e2a0d5 Mon Sep 17 00:00:00 2001 From: Daniel Pope Date: Fri, 31 May 2019 11:57:28 +0100 Subject: [PATCH] Fix style issues on master using Black --- flask/cli.py | 8 +++++--- tests/test_basic.py | 22 +++++++++++++--------- tests/test_cli.py | 2 +- tests/test_helpers.py | 1 - 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/flask/cli.py b/flask/cli.py index fdd0b765..dca728ce 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -660,9 +660,11 @@ def show_server_banner(env, debug, app_import_path, eager_loading): if env == "production": click.secho( - ' WARNING: This is a development server. ' - 'Do not use it in a production deployment.', fg='red') - click.secho(' Use a production WSGI server instead.', dim=True) + " WARNING: This is a development server. " + "Do not use it in a production deployment.", + fg="red", + ) + click.secho(" Use a production WSGI server instead.", dim=True) if debug is not None: click.echo(" * Debug mode: {0}".format("on" if debug else "off")) diff --git a/tests/test_basic.py b/tests/test_basic.py index b7eeeb40..32803b8c 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1147,12 +1147,12 @@ def test_response_types(app, client): def from_wsgi(): return NotFound() - @app.route('/dict') + @app.route("/dict") def from_dict(): return {"foo": "bar"}, 201 - 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("/text").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") assert rv.data == b"Meh" @@ -1185,7 +1185,7 @@ def test_response_types(app, client): assert b"Not Found" in rv.data assert rv.status_code == 404 - rv = client.get('/dict') + rv = client.get("/dict") assert rv.json == {"foo": "bar"} 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") def test_json_dump_dataclass(app, req_ctx): from dataclasses import make_dataclass + Data = make_dataclass("Data", [("name", str)]) value = flask.json.dumps(Data("Flask"), app=app) value = flask.json.loads(value, app=app) assert value == {"name": "Flask"} + def test_jsonify_args_and_kwargs_check(app, req_ctx): with pytest.raises(TypeError) as e: 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): - app = flask.Flask(__name__, static_folder='', static_url_path='') - rv = app.test_client().open('/static/index.html', method='GET') + app = flask.Flask(__name__, static_folder="", static_url_path="") + rv = app.test_client().open("/static/index.html", method="GET") assert rv.status_code == 200 rv.close() def test_static_url_empty_path_default(app): - app = flask.Flask(__name__, static_folder='') - rv = app.test_client().open('/static/index.html', method='GET') + app = flask.Flask(__name__, static_folder="") + rv = app.test_client().open("/static/index.html", method="GET") assert rv.status_code == 200 rv.close() @@ -1949,7 +1951,9 @@ def test_run_server_port(monkeypatch, app): (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): assert hostname == expect_host assert port == expect_port diff --git a/tests/test_cli.py b/tests/test_cli.py index 2efcbaa8..dba73a3f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -525,7 +525,7 @@ def test_load_dotenv(monkeypatch): assert os.environ["EGGS"] == "3" # Non existent file should not load - assert not load_dotenv('non-existent-file') + assert not load_dotenv("non-existent-file") @need_dotenv diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 89e15493..d1472fd4 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -976,7 +976,6 @@ class TestSafeJoin(object): print(flask.safe_join(*args)) - class TestHelpers(object): @pytest.mark.parametrize( "debug, expected_flag, expected_default_flag",