Skip to content

Commit b89a0a5

Browse files
committed
fix: format test files with ruff
- Fixed formatting in tests/unit/test_builder.py - Fixed formatting in tests/unit/test_direct_api.py - Fixed formatting in tests/unit/test_http_client.py Resolves CI formatting check failures.
1 parent 775aa60 commit b89a0a5

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

tests/unit/test_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_add_step_with_complex_options(self):
7777
"width": 200,
7878
"height": 100,
7979
"opacity": 0.5,
80-
"position": "center"
80+
"position": "center",
8181
}
8282
result = self.builder.add_step("watermark-pdf", options=options)
8383

@@ -201,7 +201,7 @@ def test_set_output_options_complex_metadata(self):
201201
"author": "Test Author",
202202
"subject": "Test Subject",
203203
"keywords": ["test", "document", "processing"],
204-
"custom": {"version": "1.0", "department": "Engineering"}
204+
"custom": {"version": "1.0", "department": "Engineering"},
205205
}
206206
result = self.builder.set_output_options(metadata=metadata)
207207

@@ -264,7 +264,7 @@ def test_map_tool_to_action_watermark_pdf(self):
264264
"width": 300,
265265
"height": 150,
266266
"opacity": 0.7,
267-
"position": "top-right"
267+
"position": "top-right",
268268
}
269269
self.builder.add_step("watermark-pdf", options=options)
270270
action = self.builder._actions[0]

tests/unit/test_direct_api.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_watermark_pdf_with_image_url(self, mock_process):
145145
width=150,
146146
height=75,
147147
opacity=0.5,
148-
position="top-right"
148+
position="top-right",
149149
)
150150

151151
assert result == self.mock_response
@@ -300,7 +300,9 @@ def test_direct_api_with_file_like_object(self, mock_process):
300300
temp_file.seek(0)
301301

302302
self.client.rotate_pages(cast(BinaryIO, temp_file), degrees=90)
303-
mock_process.assert_called_once_with("rotate-pages", cast(BinaryIO, temp_file), None, degrees=90)
303+
mock_process.assert_called_once_with(
304+
"rotate-pages", cast(BinaryIO, temp_file), None, degrees=90
305+
)
304306

305307

306308
class TestDirectAPIErrorHandling:
@@ -415,9 +417,13 @@ def test_watermark_pdf_all_positions(self, mock_process):
415417
mock_process.return_value = b"result"
416418

417419
positions = [
418-
"top-left", "top-center", "top-right",
420+
"top-left",
421+
"top-center",
422+
"top-right",
419423
"center",
420-
"bottom-left", "bottom-center", "bottom-right"
424+
"bottom-left",
425+
"bottom-center",
426+
"bottom-right",
421427
]
422428

423429
for position in positions:
@@ -452,8 +458,7 @@ def test_merge_pdfs_maximum_files(self, mock_prepare):
452458

453459
# Mock file preparation
454460
mock_prepare.side_effect = [
455-
(f"file{i}", (f"file{i}", f"content{i}".encode(), "application/pdf"))
456-
for i in range(10)
461+
(f"file{i}", (f"file{i}", f"content{i}".encode(), "application/pdf")) for i in range(10)
457462
]
458463

459464
# Mock HTTP client

tests/unit/test_http_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_api_error_with_json_response(self, mock_request):
223223
mock_response.text = '{"message": "Validation failed", "details": "Invalid file format"}'
224224
mock_response.json.return_value = {
225225
"message": "Validation failed",
226-
"details": "Invalid file format"
226+
"details": "Invalid file format",
227227
}
228228
mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError()
229229
mock_request.return_value = mock_response
@@ -292,8 +292,6 @@ def test_successful_response_204(self, mock_request):
292292
assert result == b""
293293

294294

295-
296-
297295
class TestHTTPClientContextManager:
298296
"""Test suite for HTTPClient context manager functionality."""
299297

0 commit comments

Comments
 (0)