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

e2e pdf: changed the collection and assertion #644

Merged
merged 2 commits into from
Oct 28, 2024
Merged

e2e pdf: changed the collection and assertion #644

merged 2 commits into from
Oct 28, 2024

Conversation

omehes
Copy link
Contributor

@omehes omehes commented Oct 28, 2024

No description provided.

Copy link
Contributor

@TylerZeroMaster TylerZeroMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One change I would like to see is to pdf_url. At the moment, pdf_url is a byte string containing the raw binary form of the pdf. When the tests fail, this huge byte string is printed because we run the tests with the --showlocals option. This is not a problem with io_file or pdf_read because their __repr__ only displays the class, like <pypdf._reader.PdfReader object at 0x0000deadbeef>.

I recommend replacing

pdf_url = urlopen(r_url).read()

io_file = io.BytesIO(pdf_url)

with

response = urlopen(r_url)

io_file = io.BytesIO(response.read())

That should prevent the aforementioned problem since the __repr__ for the response is something like <http.client.HTTPResponse object at ...> (rather than a huge byte string).

@omehes
Copy link
Contributor Author

omehes commented Oct 28, 2024

@TylerZeroMaster made the recommended changes

@omehes omehes merged commit 900fdcc into main Oct 28, 2024
2 checks passed
@omehes omehes deleted the epdf branch October 28, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants