]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-91520: Rewrite imghdr inlining for clarity and completeness (#91521)
authorBarry Warsaw <barry@python.org>
Fri, 15 Apr 2022 00:48:59 +0000 (17:48 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Apr 2022 00:48:59 +0000 (17:48 -0700)
commit1fcb39ea64192fc83e7b52f067856bdf977ec2c1
treedff4a834789692a338f8d210690a6bbfbb614dc4
parentee475430d431814cbb6eb5e8a6c0ae51943349d4
gh-91520: Rewrite imghdr inlining for clarity and completeness (#91521)

* Rewrite imghdr inlining for clarity and completeness

* Move MIMEImage class back closer to the top of the file since it's the
  important thing.
* Use a decorate to mark a given rule function and simplify the rule function
  names for clarity.
* Copy over all the imghdr test data files into the email package's test data
  directory.  This way when imghdr is actually removed, it won't affect the
  MIMEImage guessing tests.
* Rewrite and extend the MIMEImage tests to test for all supported
  auto-detected MIME image subtypes.
* Remove the now redundant PyBanner048.gif data file.

* See https://github.com/python/cpython/pull/91461#discussion_r850313336

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
17 files changed:
Doc/includes/email-mime.py
Lib/email/mime/image.py
Lib/test/test_email/data/PyBanner048.gif [deleted file]
Lib/test/test_email/data/python.bmp [new file with mode: 0644]
Lib/test/test_email/data/python.exr [new file with mode: 0644]
Lib/test/test_email/data/python.gif [new file with mode: 0644]
Lib/test/test_email/data/python.jpg [new file with mode: 0644]
Lib/test/test_email/data/python.pbm [new file with mode: 0644]
Lib/test/test_email/data/python.pgm [new file with mode: 0644]
Lib/test/test_email/data/python.png [new file with mode: 0644]
Lib/test/test_email/data/python.ppm [new file with mode: 0644]
Lib/test/test_email/data/python.ras [new file with mode: 0644]
Lib/test/test_email/data/python.sgi [new file with mode: 0644]
Lib/test/test_email/data/python.tiff [new file with mode: 0644]
Lib/test/test_email/data/python.webp [new file with mode: 0644]
Lib/test/test_email/data/python.xbm [new file with mode: 0644]
Lib/test/test_email/test_email.py