From e63d5a78f7dbebd322b6ea7f9d82cb195e2b2bab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:51:07 +0000 Subject: [PATCH] fix: apply ruff formatting to 6 test files Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- tests/test_api_azure_comprehensive.py | 12 +++++++++--- tests/test_external_integrations.py | 12 ++++++------ tests/test_file_splitting.py | 6 +++--- tests/test_security_headers.py | 6 +++--- tests/test_upload_ftp_additional.py | 4 +--- tests/test_upload_webdav_integration.py | 6 +++--- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/tests/test_api_azure_comprehensive.py b/tests/test_api_azure_comprehensive.py index 42ff8505..dd52f3c5 100644 --- a/tests/test_api_azure_comprehensive.py +++ b/tests/test_api_azure_comprehensive.py @@ -110,7 +110,9 @@ class TestAzureTestConnectionEndpoint: @patch("app.api.azure.AzureKeyCredential") @patch("app.api.azure.settings") @pytest.mark.asyncio - async def test_azure_connection_service_request_error(self, mock_settings, mock_credential, mock_admin_client_class): + async def test_azure_connection_service_request_error( + self, mock_settings, mock_credential, mock_admin_client_class + ): """Test connection with service request error.""" from app.api.azure import test_azure_connection @@ -196,7 +198,9 @@ class TestAzureTestConnectionEndpoint: @patch("app.api.azure.AzureKeyCredential") @patch("app.api.azure.settings") @pytest.mark.asyncio - async def test_azure_connection_with_empty_operations(self, mock_settings, mock_credential, mock_admin_client_class): + async def test_azure_connection_with_empty_operations( + self, mock_settings, mock_credential, mock_admin_client_class + ): """Test connection returning empty operations list.""" from app.api.azure import test_azure_connection @@ -325,7 +329,9 @@ class TestAzureTestConnectionEndpoint: @patch("app.api.azure.AzureKeyCredential") @patch("app.api.azure.settings") @pytest.mark.asyncio - async def test_azure_connection_uses_credential(self, mock_settings, mock_credential_class, mock_admin_client_class): + async def test_azure_connection_uses_credential( + self, mock_settings, mock_credential_class, mock_admin_client_class + ): """Test that AzureKeyCredential is used correctly.""" from app.api.azure import test_azure_connection diff --git a/tests/test_external_integrations.py b/tests/test_external_integrations.py index 30c0166d..5fab2016 100644 --- a/tests/test_external_integrations.py +++ b/tests/test_external_integrations.py @@ -244,9 +244,9 @@ class TestAzureDocumentIntelligenceIntegration: assert len(result.content) > 10, f"OCR text too short: {result.content[:50]}" # Verify the generated text is recognizable - assert ( - "Acme" in result.content or "Invoice" in result.content - ), f"OCR text does not contain expected keywords: {result.content[:200]}" + assert "Acme" in result.content or "Invoice" in result.content, ( + f"OCR text does not contain expected keywords: {result.content[:200]}" + ) # Retrieve the searchable PDF output operation_id = poller.details["operation_id"] @@ -602,9 +602,9 @@ class TestFullOCRMetadataPipeline: # The generated invoice should be classified reasonably doc_type = metadata["document_type"].lower() - assert any( - kw in doc_type for kw in ("invoice", "rechnung", "bill") - ), f"Unexpected document_type: {metadata['document_type']}" + assert any(kw in doc_type for kw in ("invoice", "rechnung", "bill")), ( + f"Unexpected document_type: {metadata['document_type']}" + ) finally: os.unlink(pdf_path) diff --git a/tests/test_file_splitting.py b/tests/test_file_splitting.py index f88460da..9682e6df 100644 --- a/tests/test_file_splitting.py +++ b/tests/test_file_splitting.py @@ -83,9 +83,9 @@ class TestSplitPdfBySize: # that can cause files to exceed the target size by ~20-50%. We allow 1.5x (50%) margin. PDF_OVERHEAD_MULTIPLIER = 1.5 for split_file in split_files: - assert ( - os.path.getsize(split_file) <= max_size * PDF_OVERHEAD_MULTIPLIER - ), f"Split file {split_file} should respect size limit (with PDF overhead allowance)" + assert os.path.getsize(split_file) <= max_size * PDF_OVERHEAD_MULTIPLIER, ( + f"Split file {split_file} should respect size limit (with PDF overhead allowance)" + ) # Cleanup split files for split_file in split_files: diff --git a/tests/test_security_headers.py b/tests/test_security_headers.py index 4a22f306..93dc711a 100644 --- a/tests/test_security_headers.py +++ b/tests/test_security_headers.py @@ -144,9 +144,9 @@ def test_x_frame_options_valid_value(client): x_frame_value = response.headers["X-Frame-Options"] valid_values = ["DENY", "SAMEORIGIN"] # Note: ALLOW-FROM is deprecated in modern browsers; use CSP frame-ancestors instead - assert x_frame_value in valid_values or x_frame_value.startswith( - "ALLOW-FROM" - ), f"Invalid X-Frame-Options value: {x_frame_value}" + assert x_frame_value in valid_values or x_frame_value.startswith("ALLOW-FROM"), ( + f"Invalid X-Frame-Options value: {x_frame_value}" + ) @pytest.mark.integration diff --git a/tests/test_upload_ftp_additional.py b/tests/test_upload_ftp_additional.py index 92102078..cdcafdf3 100644 --- a/tests/test_upload_ftp_additional.py +++ b/tests/test_upload_ftp_additional.py @@ -24,9 +24,7 @@ class TestUploadToFtp: @patch("app.tasks.upload_to_ftp.os.path.exists") @patch("app.tasks.upload_to_ftp.settings") @patch("builtins.open", create=True) - def test_uploads_file_with_ftps( - self, mock_open, mock_settings, mock_exists, mock_log, mock_ftp_tls, mock_basename - ): + def test_uploads_file_with_ftps(self, mock_open, mock_settings, mock_exists, mock_log, mock_ftp_tls, mock_basename): """Test uploads file using FTPS (FTP with TLS).""" mock_exists.return_value = True mock_basename.return_value = "test.pdf" diff --git a/tests/test_upload_webdav_integration.py b/tests/test_upload_webdav_integration.py index e0dfc55f..dd7fa627 100644 --- a/tests/test_upload_webdav_integration.py +++ b/tests/test_upload_webdav_integration.py @@ -305,9 +305,9 @@ class TestWebDAVIntegration: response = requests.get(file_url, auth=(webdav_server["username"], webdav_server["password"]), timeout=10) assert response.status_code == 200 - assert ( - len(response.content) == 1024 * 1024 - ), f"File size mismatch: expected 1MB, got {len(response.content)} bytes" + assert len(response.content) == 1024 * 1024, ( + f"File size mismatch: expected 1MB, got {len(response.content)} bytes" + ) @pytest.mark.integration