From c36701742e65a9bf99e93ddfcfcbf4e38335a573 Mon Sep 17 00:00:00 2001 From: Jumana B Date: Thu, 19 Sep 2024 09:54:34 -0400 Subject: [PATCH] reformat based on ruff changes (#1950) --- app/utils.py | 2 +- application.py | 2 +- tests/app/main/test_strip_whitespace_form.py | 2 +- tests/app/main/test_validators.py | 2 +- tests/app/main/views/test_service_settings.py | 2 -- tests/app/main/views/test_templates.py | 4 ++-- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/utils.py b/app/utils.py index 96f18055b0..bd6bddef2c 100644 --- a/app/utils.py +++ b/app/utils.py @@ -269,7 +269,7 @@ def generate_notifications_csv(**kwargs): ] ) # Add encoded Byte Order Mark to the csv so MS Excel treats it as UTF-8 and properly renders accented FR characters. - yield "\uFEFF".encode("utf-8") + yield "\ufeff".encode("utf-8") yield ",".join(fieldnames) + "\n" while kwargs["page"]: diff --git a/application.py b/application.py index 8f82113d4f..39512e18b4 100644 --- a/application.py +++ b/application.py @@ -16,7 +16,7 @@ application = Flask("app") application.wsgi_app = ProxyFix(application.wsgi_app) # type: ignore -xray_recorder.configure(service='Notify-Admin') +xray_recorder.configure(service="Notify-Admin") XRayMiddleware(application, xray_recorder) create_app(application) diff --git a/tests/app/main/test_strip_whitespace_form.py b/tests/app/main/test_strip_whitespace_form.py index 1db01a4052..112ead9726 100644 --- a/tests/app/main/test_strip_whitespace_form.py +++ b/tests/app/main/test_strip_whitespace_form.py @@ -20,7 +20,7 @@ class ExampleFormSpecialField(Form): """ \t bar """, - " \u180E\u200B \u200C bar \u200D \u2060\uFEFF ", + " \u180e\u200b \u200c bar \u200d \u2060\ufeff ", ], ) @pytest.mark.parametrize( diff --git a/tests/app/main/test_validators.py b/tests/app/main/test_validators.py index 05725a11d4..c56fce56f7 100644 --- a/tests/app/main/test_validators.py +++ b/tests/app/main/test_validators.py @@ -130,7 +130,7 @@ def test_for_commas_in_placeholders(client): NoCommasInPlaceHolders()(None, _gen_mock_field("Hello ((name))")) -@pytest.mark.parametrize("msg", ["The quick brown fox", "Thé “quick” bröwn fox\u200B"]) +@pytest.mark.parametrize("msg", ["The quick brown fox", "Thé “quick” bröwn fox\u200b"]) def test_sms_character_validation(client, msg): OnlySMSCharacters()(None, _gen_mock_field(msg)) diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 32a0ec6917..49c94a005e 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -4294,7 +4294,6 @@ def test_update_service_data_retention_populates_form( class TestSettingSensitiveService: - def test_should_redirect_after_change_service_name( self, client_request, @@ -4310,7 +4309,6 @@ def test_should_redirect_after_change_service_name( class TestSuspendingCallbackApi: def test_should_suspend_service_callback_api(self, client_request, platform_admin_user, mocker, service_one): - client_request.login(platform_admin_user, service_one) client_request.post( "main.suspend_callback", diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 2329dcc99b..c4fa5b0b3e 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -853,7 +853,7 @@ def test_should_show_sms_template_with_downgraded_unicode_characters( mock_get_template_folders, fake_uuid, ): - msg = "here:\tare some “fancy quotes” and zero\u200Bwidth\u200Bspaces" + msg = "here:\tare some “fancy quotes” and zero\u200bwidth\u200bspaces" rendered_msg = 'here: are some "fancy quotes" and zerowidthspaces' mocker.patch( @@ -2477,7 +2477,7 @@ def test_should_not_update_sms_template_with_emoji( def test_should_create_sms_template_without_downgrading_unicode_characters( client_request, mock_create_service_template, mock_get_template_categories, app_ ): - msg = "here:\tare some “fancy quotes” and non\u200Bbreaking\u200Bspaces" + msg = "here:\tare some “fancy quotes” and non\u200bbreaking\u200bspaces" client_request.post( ".add_service_template",