python-imaging/Pillow — pull request #626 by hugovk (2014-04-16 08:38:10+00:00)
Title: Fix a "mode == 'RGBA'

PR #616 to clean code includes two functional changes (`==` that should be `=`) but without tests (requested by @wiredfool).

```
elif csiz == 4:
mode == 'RGBA'
```

Here's a test for the first one (line 48) that fails before any changes, and passes with `==` changed to `=`:
```
mode == 'RGBA'
UnboundLocalError: local variable 'mode' referenced before assignment
```
Failing build: https://travis-ci.org/hugovk/Pillow/jobs/22942098
Passing build: https://travis-ci.org/hugovk/Pillow/jobs/22942992

I added two test images, created with ImageMagick on Windows. This fix is with the .j2k file. I was hoping the .jp2 would cover the other one but it didn't. *

---

I think the test images should be renamed somehow. Suggestions?

Please can someone else create a test .jp2 file for the other case? It needs to hit [line 125](https://github.com/python-imaging/Pillow/blob/master/PIL/Jpeg2KImagePlugin.py#L125).

---

\* When I did some testing (on Windows), the .jp2's signature is different.

* Actual: `\x00\x00\x00\x0cjP \n\x87\n\x00`
* Expected: `\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a` ([line 145](https://github.com/python-imaging/Pillow/blob/master/PIL/Jpeg2KImagePlugin.py#L145))