Skip to content

Commit 9d8eab7

Browse files
committed
style(tests): apply ruff format/lint fixes to pre-existing test files
Picked up by ruff/ruff-format pre-commit hooks while committing unrelated work; no logic changes — unused imports, blank-line spacing, and line-wrap formatting only.
1 parent 0bdb4fb commit 9d8eab7

6 files changed

Lines changed: 34 additions & 27 deletions

File tree

AWS/tests/integration/test_feishu.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from src.jobs.callbacks.feishu import FeishuCallback
1212
from src.workflows.engine import WorkflowResult
1313

14-
1514
# ---------------------------------------------------------------------------
1615
# Fixtures
1716
# ---------------------------------------------------------------------------

AWS/tests/integration/test_monopoly.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from src.workflows.steps.base import ComputeTarget, WorkflowContext
1313
from src.workflows.steps.process import ProcessStep
1414

15-
1615
# ---------------------------------------------------------------------------
1716
# Fixtures
1817
# ---------------------------------------------------------------------------
@@ -59,7 +58,11 @@ def test_brand_concentration(self, analyzer):
5958

6059
def test_review_barrier(self, analyzer):
6160
high = [
62-
{"rank": i, "review_count": 10000 if i <= 10 else 100, "rating": 4.6 if i <= 10 else 4.0}
61+
{
62+
"rank": i,
63+
"review_count": 10000 if i <= 10 else 100,
64+
"rating": 4.6 if i <= 10 else 4.0,
65+
}
6366
for i in range(1, 60)
6467
]
6568
low = [

AWS/tests/live/test_comments.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import asyncio
43
import logging
54
import os
65
import sys

AWS/tests/unit/test_calibration.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import json
44
import os
5-
import shutil
6-
import tempfile
75
import threading
86

97
import pytest
@@ -16,7 +14,6 @@
1614
save_calibration,
1715
)
1816

19-
2017
# ---------------------------------------------------------------------------
2118
# Fixtures
2219
# ---------------------------------------------------------------------------

AWS/tests/unit/test_job_error_mapping.py

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Error → callback mapping tests for JobManager._run_job."""
2+
23
from __future__ import annotations
34

45
from contextlib import asynccontextmanager
5-
from unittest.mock import MagicMock, AsyncMock, patch
6+
from unittest.mock import AsyncMock, MagicMock, patch
67

78
import pytest
89

@@ -11,8 +12,12 @@
1112

1213
class _FakeSlot:
1314
"""Minimal async context manager that does nothing."""
14-
async def __aenter__(self): return self
15-
async def __aexit__(self, *args): pass
15+
16+
async def __aenter__(self):
17+
return self
18+
19+
async def __aexit__(self, *args):
20+
pass
1621

1722

1823
@asynccontextmanager
@@ -44,9 +49,7 @@ def record():
4449

4550
async def _run_job_with_error(mgr, rec, error):
4651
mgr._jobs[rec.job_id] = rec
47-
with patch(
48-
"src.gateway.rate_limit.RateLimiter.concurrent_slot", _fake_concurrent_slot
49-
):
52+
with patch("src.gateway.rate_limit.RateLimiter.concurrent_slot", _fake_concurrent_slot):
5053
with patch.object(mgr, "_run_workflow_mode") as mock_run:
5154
mock_run.side_effect = error
5255
await mgr._run_job(rec.job_id)
@@ -62,11 +65,15 @@ async def test_maps_to_suspended_not_error(self, manager, record):
6265
record.callback.on_error = AsyncMock()
6366

6467
await _run_job_with_error(
65-
manager, record,
68+
manager,
69+
record,
6670
BatchPendingError(
67-
"batch submitted", batch_job_id="batch_123",
71+
"batch submitted",
72+
batch_job_id="batch_123",
6873
handle=MagicMock(provider="gemini"),
69-
requests=[], items_snapshot=[], output_field="analysis",
74+
requests=[],
75+
items_snapshot=[],
76+
output_field="analysis",
7077
),
7178
)
7279

@@ -84,11 +91,15 @@ async def test_notifies_with_batch_id(self, manager, record):
8491
record.callback.on_progress = AsyncMock()
8592

8693
await _run_job_with_error(
87-
manager, record,
94+
manager,
95+
record,
8896
BatchPendingError(
89-
"batch submitted", batch_job_id="batch_abc",
97+
"batch submitted",
98+
batch_job_id="batch_abc",
9099
handle=MagicMock(provider="gemini"),
91-
requests=[], items_snapshot=[], output_field="analysis",
100+
requests=[],
101+
items_snapshot=[],
102+
output_field="analysis",
92103
),
93104
)
94105

@@ -104,7 +115,8 @@ async def test_maps_to_failed_with_on_error(self, manager, record):
104115
record.callback.on_error = AsyncMock()
105116

106117
await _run_job_with_error(
107-
manager, record,
118+
manager,
119+
record,
108120
RetryableError("rate limited", http_status=429, provider="test"),
109121
)
110122

@@ -120,7 +132,8 @@ async def test_notify_for_concurrent_limit(self, manager, record):
120132
record.callback.on_error = AsyncMock()
121133

122134
await _run_job_with_error(
123-
manager, record,
135+
manager,
136+
record,
124137
RuntimeError("concurrent limit reached for entry_type=cli_workflow"),
125138
)
126139

AWS/tests/unit/test_xiyou.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from src.mcp.servers.market.tools import handle_market_tool, market_tools
1010
from src.mcp.servers.market.xiyouzhaoci.client import XiyouZhaociAPI
1111

12-
1312
# ---------------------------------------------------------------------------
1413
# Fixtures
1514
# ---------------------------------------------------------------------------
@@ -188,8 +187,7 @@ def test_empty_asins(self, mock_api_authed):
188187
assert result["success"] is True
189188
assert mock_request.call_count == 1
190189
assert (
191-
mock_request.call_args[1]["headers"]["request-url"]
192-
== "/detail/asin/look_up/US/unknown"
190+
mock_request.call_args[1]["headers"]["request-url"] == "/detail/asin/look_up/US/unknown"
193191
)
194192

195193
def test_error(self, mock_api_authed):
@@ -239,6 +237,4 @@ async def test_handle_traffic_scores(self):
239237
data = json.loads(result[0].text)
240238
assert data == mock_response
241239

242-
mock_api_instance.get_traffic_scores.assert_called_once_with(
243-
country="US", asins=asins
244-
)
240+
mock_api_instance.get_traffic_scores.assert_called_once_with(country="US", asins=asins)

0 commit comments

Comments
 (0)