style: apply ruff auto-fix

- Auto-formatted code with ruff format
- Applied ruff linting fixes with --fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-02-14 00:05:57 +00:00
parent 331b3a3a1a
commit fc515ebb70
2 changed files with 37 additions and 25 deletions
+3 -1
View File
@@ -371,7 +371,6 @@ class TestAzureTestConnectionIntegration:
data = response.json() data = response.json()
assert "status" in data assert "status" in data
@patch("app.api.azure.settings") @patch("app.api.azure.settings")
@patch("app.api.azure.logger") @patch("app.api.azure.logger")
@pytest.mark.asyncio @pytest.mark.asyncio
@@ -518,6 +517,7 @@ class TestAzureTestConnectionIntegration:
async def test_azure_connection_logs_outer_exception(self, mock_logger, mock_settings): async def test_azure_connection_logs_outer_exception(self, mock_logger, mock_settings):
"""Test that exceptions in outer try block are logged with exception().""" """Test that exceptions in outer try block are logged with exception()."""
from unittest.mock import PropertyMock from unittest.mock import PropertyMock
from app.api.azure import test_azure_connection from app.api.azure import test_azure_connection
# Trigger an exception in the outer try block # Trigger an exception in the outer try block
@@ -545,6 +545,7 @@ class TestAzureTestConnectionIntegration:
): ):
"""Test that warning is logged when operations parsing fails.""" """Test that warning is logged when operations parsing fails."""
from unittest.mock import PropertyMock from unittest.mock import PropertyMock
from app.api.azure import test_azure_connection from app.api.azure import test_azure_connection
mock_settings.azure_endpoint = "https://test.cognitiveservices.azure.com/" mock_settings.azure_endpoint = "https://test.cognitiveservices.azure.com/"
@@ -575,6 +576,7 @@ class TestAzureTestConnectionIntegration:
async def test_azure_connection_outer_exception_handler(self, mock_settings): async def test_azure_connection_outer_exception_handler(self, mock_settings):
"""Test the outer exception handler catches unexpected errors.""" """Test the outer exception handler catches unexpected errors."""
from unittest.mock import PropertyMock from unittest.mock import PropertyMock
from app.api.azure import test_azure_connection from app.api.azure import test_azure_connection
# Create a mock that raises exception when azure_endpoint is accessed using PropertyMock # Create a mock that raises exception when azure_endpoint is accessed using PropertyMock
+15 -5
View File
@@ -318,7 +318,9 @@ class TestLogTaskProgressWithFileProcessingStep:
mock_db.query.return_value.filter.return_value.first.return_value = None mock_db.query.return_value.filter.return_value.first.return_value = None
# Mock datetime # Mock datetime
from datetime import datetime as dt, timezone from datetime import datetime as dt
from datetime import timezone
mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
mock_datetime.now.return_value = mock_now mock_datetime.now.return_value = mock_now
mock_datetime.timezone = timezone mock_datetime.timezone = timezone
@@ -359,7 +361,9 @@ class TestLogTaskProgressWithFileProcessingStep:
mock_db.query.return_value.filter.return_value.first.return_value = None mock_db.query.return_value.filter.return_value.first.return_value = None
from datetime import datetime as dt, timezone from datetime import datetime as dt
from datetime import timezone
mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
mock_datetime.now.return_value = mock_now mock_datetime.now.return_value = mock_now
mock_datetime.timezone = timezone mock_datetime.timezone = timezone
@@ -396,7 +400,9 @@ class TestLogTaskProgressWithFileProcessingStep:
mock_db.query.return_value.filter.return_value.first.return_value = None mock_db.query.return_value.filter.return_value.first.return_value = None
from datetime import datetime as dt, timezone from datetime import datetime as dt
from datetime import timezone
mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
mock_datetime.now.return_value = mock_now mock_datetime.now.return_value = mock_now
mock_datetime.timezone = timezone mock_datetime.timezone = timezone
@@ -434,7 +440,9 @@ class TestLogTaskProgressWithFileProcessingStep:
mock_existing_step.started_at = None mock_existing_step.started_at = None
mock_db.query.return_value.filter.return_value.first.return_value = mock_existing_step mock_db.query.return_value.filter.return_value.first.return_value = mock_existing_step
from datetime import datetime as dt, timezone from datetime import datetime as dt
from datetime import timezone
mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
mock_datetime.now.return_value = mock_now mock_datetime.now.return_value = mock_now
mock_datetime.timezone = timezone mock_datetime.timezone = timezone
@@ -467,7 +475,9 @@ class TestLogTaskProgressWithFileProcessingStep:
mock_existing_step.started_at = None mock_existing_step.started_at = None
mock_db.query.return_value.filter.return_value.first.return_value = mock_existing_step mock_db.query.return_value.filter.return_value.first.return_value = mock_existing_step
from datetime import datetime as dt, timezone from datetime import datetime as dt
from datetime import timezone
mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) mock_now = dt(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
mock_datetime.now.return_value = mock_now mock_datetime.now.return_value = mock_now
mock_datetime.timezone = timezone mock_datetime.timezone = timezone