-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MAINT: Increase readability of _merge_page #3291
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
base: main
Are you sure you want to change the base?
Conversation
Mainly moving declarations nearer their use.
Mainly moving declarations nearer their use.
This PR is wrong, I should not have moved the annotations. Will either close or change... |
I am going to mark this PR as draft. Feel free to either close or mark it ready for review if you decided on an approach. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3291 +/- ##
==========================================
+ Coverage 96.97% 96.99% +0.01%
==========================================
Files 54 56 +2
Lines 9324 9384 +60
Branches 1708 1714 +6
==========================================
+ Hits 9042 9102 +60
Misses 168 168
Partials 114 114 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@stefan6419846 code coverage has decreased but seems as if it should be the same? Moving the annotations is okay also. |
The case where https://github.com/py-pdf/pypdf/pull/3291/files#diff-153e5cee71ddf471246ff5c0e198345f005942a540a8f39297736f0b620d631dR1225 does not hold true is not covered by the tests (although it has never been as far as I can see). Are we able to test this as well? |
Which test needs changing? |
See coverage/my previous comment. |
|
I am not aware of this unless you modify the coverage configuration. In my cases, I usually run the tests with raising an exception in this specific section locally. |
Unsure why this is giving an error. Is there a PDF in the resources folder with multiple annotations on a page? |
|
||
page_one = writer.pages[0] | ||
page_two = writer.pages[0] | ||
page_one.merge_page(page_two) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you trying to merge a page with itself? This looks somehow wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the idea, see test_no_resources
, but that uses PdfReader
. But agree, probably not best practice.
This seems to be a bug which already existed previously, although I am not sure why this never has been a problem in the past. The underlying problem is that we try to create a new Polygon instance, but the default code from |
No description provided.