Skip to content

Commit 9d0f899

Browse files
committed
fix: handle default case in split_pdf when page_ranges is None
The split_pdf method was raising ValueError when page_ranges was None, but the docstring and tests expect it to default to extracting the first page. Updated to set page_ranges to [{"start": 0, "end": 1}] when None is provided. This fixes the failing test_split_pdf_single_page_default test.
1 parent e0dda7d commit 9d0f899

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/nutrient_dws/api/direct.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def split_pdf(
283283

284284
# Validate inputs
285285
if not page_ranges:
286-
raise ValueError("page_ranges is required")
286+
# Default behavior: extract first page only
287+
page_ranges = [{"start": 0, "end": 1}]
287288

288289
if len(page_ranges) > 50:
289290
raise ValueError("Maximum 50 page ranges allowed")

0 commit comments

Comments
 (0)