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 unittests for imghdr module #64189
Comments
Hello! The following patch adds unit tests for the previously untested |
Beside my review, I think we need one more test that tests the invalid image file, for example file with header b'cutecat'. |
Thanks for the review, Vajrasky! Here's the updated version. |
Hello. Here's a new version which uses real image files as testing data. |
I made a simple exr file with the lib Exr (it's a half float ZIP16 RGBA file), in order to add real exr file to the unit test. Sorry, i don't know how to create an update version of your patch (i just start to use mercurial), so i just upload the sample. |
In general the patch LGTM, but additional tests can be added. Needed various tests for imghdr.what() arguments:
Try to insert test function which handles one of already supported format at the front of imghdr.test. |
Hello! Here's the new version of the patch, with tests proposed by Serhiy. |
Looks as you forgot to include some test files in the patch. And these files are too large. Much smaller images would be enough. For example you can use python.org icon: http://www.python.org/favicon.ico. |
Here's a smaller patch. Serhiy, what test files are missing? |
Last patch contains only pbm and xbm test files, while test_imghdr expects 11 different image files: png, gif, bmp, etc. |
Ah, I understand now. Maybe it is related to the fact that I used
Although I'm not sure why it doesn't work in your case. |
Oh, yes, my bad. I used the patch utility. Sorry. |
New changeset b28909d501c0 by Serhiy Storchaka in branch '2.7': New changeset fde9e9832749 by Serhiy Storchaka in branch '3.3': New changeset 94813eab5a58 by Serhiy Storchaka in branch 'default': |
Thank you Claudiu. I have reorganized tests somewhat and added new test for file position. |
New changeset e2d013e90e88 by Ned Deily in branch '2.7': New changeset 5fbe155e62b0 by Ned Deily in branch '3.3': New changeset b41ba99a276c by Ned Deily in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: