Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning for out-of-bounds page range in pdfly cat command #58

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

Zingzy
Copy link
Contributor

@Zingzy Zingzy commented Oct 6, 2024

PR Description

This PR addresses issue #33 where users attempting to use the pdfly cat command to extract a range of pages outside the number of pages in the PDF document do not receive a warning. The following changes have been made:

  • Implemented a warning message: Added logic to check if the specified page range is out of bounds and print a warning to stderr if it is.
  • Removed the pytest.skip decorator from the test case: Enabled the test_cat_subset_warn_on_missing_pages test to verify the warning message in stderr.

Testing

  • Ran the updated test suite to ensure that the warning message is correctly produced and captured.
  • Verified that the test_cat_subset_warn_on_missing_pages test passes, confirming that the warning is printed to stderr when the page range is out of bounds.

@Lucas-C
Copy link
Member

Lucas-C commented Oct 7, 2024

Hi @Zingzy

This looks great, thank your for your contribution 👍

Could you just run black pdfly/cat.py and include the changes in this PR?
Currently the GitHub Actions pipeline fails because this code formatter has not been applied to this file following your changes:
https://github.com/py-pdf/pdfly/actions/runs/11204446524/job/31171421427?pr=58

@Zingzy
Copy link
Contributor Author

Zingzy commented Oct 7, 2024

Hello @Lucas-C, I made the necessary changes. 😄

@Zingzy
Copy link
Contributor Author

Zingzy commented Oct 8, 2024

Hello @Lucas-C any updates on this?

@Lucas-C Lucas-C merged commit 1aefb3a into py-pdf:main Oct 8, 2024
6 checks passed
@Lucas-C
Copy link
Member

Lucas-C commented Oct 8, 2024

I merged your MR!

Thank you very much for your contribution @Zingzy 👍

ebotiab pushed a commit to ebotiab/pdfly that referenced this pull request Oct 15, 2024
MartinThoma added a commit that referenced this pull request Dec 8, 2024
## What's new

### New Features (ENH)
- New `booklet` command to adjust offsets and lengths ([PR #77](#77))
- New `uncompress` command ([PR #75](#75))
- New `update-offsets` command to adjust offsets and lengths ([PR #15](#15))
- New `rm` command ([PR #59](#59))
- `metadata`: now also displaying CreationDate, Creator, Keywords & Subject ([PR #73](#73))
- Add warning for out-of-bounds page range in pdfly `cat` command ([PR #58](#58))

### Bug Fixes (BUG)
- `2-up` command, that only showed one page per sheet, on the left side, with blank space on the right ([PR #78](#78))

[Full Changelog](0.3.3...0.4.0)
@Lucas-C
Copy link
Member

Lucas-C commented Dec 8, 2024

This has been released in version 0.4.0: https://pypi.org/project/pdfly/#history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants