lincolnloop/python-qrcode — pull request #40 by ijl (2013-09-05 18:48:22+00:00)
Title: Fix PymagingImage cannot save

If one uses `PymagingImage` as their QRCode's `image_factory`, the image_factory transforms its `kind` of "PNG" to "png" for compatibility with the library `pymaging_png`, and its super's `check_kind()` checks for the /transformed/ value in the instance's `allowed_kinds` tuple.

I've fixed this by modifying `BaseImage.check_kind()` to check for either the original or transformed value in `allowed_kinds`.

This did not appear in the tests because this is only triggered on calling the image's `save()`, and the tests stop at `make_image()`. I've therefore modified the render tests to save to an `io.BytesIO` object, which I believe is the most compatible (2 to 3) way of doing this.