Skip to content

Commit 644f5ab

Browse files
committed
fix: update test_split_pdf_no_ranges_error to match new default behavior
The test was expecting split_pdf() to raise an error when called without page_ranges, but the implementation now defaults to extracting the first page to match the docstring behavior and test_split_pdf_single_page_default. Updated the test to verify it returns a single-page PDF instead of raising an error, resolving the conflict between test expectations.
1 parent 9d0f899 commit 644f5ab

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/integration/test_direct_api_integration.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,15 @@ def test_split_pdf_with_output_files(self, client, sample_multipage_pdf_path, tm
297297
assert_is_pdf(str(tmp_path / "remaining.pdf"))
298298

299299
def test_split_pdf_no_ranges_error(self, client, sample_pdf_path):
300-
"""Test split_pdf with no ranges raises error."""
301-
# Test that page_ranges is required
302-
with pytest.raises(ValueError, match="page_ranges is required"):
303-
client.split_pdf(sample_pdf_path)
300+
"""Test split_pdf with no ranges returns first page by default."""
301+
# When no page_ranges provided, should default to first page
302+
result = client.split_pdf(sample_pdf_path)
303+
304+
assert isinstance(result, list)
305+
assert len(result) == 1 # Should return single PDF (first page)
306+
assert isinstance(result[0], bytes)
307+
assert len(result[0]) > 0
308+
assert_is_pdf(result[0])
304309

305310
def test_split_pdf_output_paths_length_mismatch_error(self, client, sample_pdf_path):
306311
"""Test split_pdf method with mismatched output_paths and page_ranges lengths."""

0 commit comments

Comments
 (0)