From 265a24fe7efad06f34ce66f21ef8ad28e4151f72 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 28 Jan 2025 15:59:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8(back)=20update=20code=20linting=20?= =?UTF-8?q?with=20ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply new rules provided with ruff version v0.9.3 --- .../test_update_files_content_type_metadata.py | 6 +++--- .../core/tests/templates/test_api_templates_list.py | 12 ++++++------ .../tests/test_services_collaboration_services.py | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/backend/core/tests/commands/test_update_files_content_type_metadata.py b/src/backend/core/tests/commands/test_update_files_content_type_metadata.py index 4ece3614..3ef78314 100644 --- a/src/backend/core/tests/commands/test_update_files_content_type_metadata.py +++ b/src/backend/core/tests/commands/test_update_files_content_type_metadata.py @@ -42,9 +42,9 @@ def test_update_files_content_type_metadata(): for key in keys: head_resp = s3_client.head_object(Bucket=bucket_name, Key=key) - assert ( - head_resp["ContentType"] == "image/png" - ), f"ContentType not fixed, got {head_resp['ContentType']!r}" + assert head_resp["ContentType"] == "image/png", ( + f"ContentType not fixed, got {head_resp['ContentType']!r}" + ) # Check that original metadata was preserved assert head_resp["Metadata"].get("owner") == "None" diff --git a/src/backend/core/tests/templates/test_api_templates_list.py b/src/backend/core/tests/templates/test_api_templates_list.py index 44582b8f..11df4fa9 100644 --- a/src/backend/core/tests/templates/test_api_templates_list.py +++ b/src/backend/core/tests/templates/test_api_templates_list.py @@ -187,9 +187,9 @@ def test_api_templates_list_order_default(): response_template_ids = [template["id"] for template in response_data["results"]] template_ids.reverse() - assert ( - response_template_ids == template_ids - ), "created_at values are not sorted from newest to oldest" + assert response_template_ids == template_ids, ( + "created_at values are not sorted from newest to oldest" + ) def test_api_templates_list_order_param(): @@ -215,6 +215,6 @@ def test_api_templates_list_order_param(): response_template_ids = [template["id"] for template in response_data["results"]] - assert ( - response_template_ids == templates_ids - ), "created_at values are not sorted from oldest to newest" + assert response_template_ids == templates_ids, ( + "created_at values are not sorted from oldest to newest" + ) diff --git a/src/backend/core/tests/test_services_collaboration_services.py b/src/backend/core/tests/test_services_collaboration_services.py index 7d02e252..5a915170 100644 --- a/src/backend/core/tests/test_services_collaboration_services.py +++ b/src/backend/core/tests/test_services_collaboration_services.py @@ -55,9 +55,9 @@ def mock_reset_connections(settings): ) yield - assert ( - len(rsps.calls) == 1 - ), "Expected one call to reset-connections endpoint" + assert len(rsps.calls) == 1, ( + "Expected one call to reset-connections endpoint" + ) request = rsps.calls[0].request assert request.url == endpoint_url, f"Unexpected URL called: {request.url}" assert ( @@ -66,9 +66,9 @@ def mock_reset_connections(settings): ), "Incorrect Authorization header" if user_id: - assert ( - request.headers.get("X-User-Id") == user_id - ), "Incorrect X-User-Id header" + assert request.headers.get("X-User-Id") == user_id, ( + "Incorrect X-User-Id header" + ) return _mock_reset_connections