mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #3042 from hugovk/3006-parser-feed
Fix TypeError for JPEG2000 parser feed
This commit is contained in:
commit
0e9f07def9
|
@ -176,6 +176,19 @@ class TestFileJpeg2k(PillowTestCase):
|
|||
with self.assertRaises(IOError):
|
||||
Image.open('Tests/images/unbound_variable.jp2')
|
||||
|
||||
def test_parser_feed(self):
|
||||
# Arrange
|
||||
from PIL import ImageFile
|
||||
with open('Tests/images/test-card-lossless.jp2', 'rb') as f:
|
||||
data = f.read()
|
||||
|
||||
# Act
|
||||
p = ImageFile.Parser()
|
||||
p.feed(data)
|
||||
|
||||
# Assert
|
||||
self.assertEqual(p.image.size, (640, 480))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -192,7 +192,7 @@ class Jpeg2KImageFile(ImageFile.ImageFile):
|
|||
length = -1
|
||||
|
||||
self.tile = [('jpeg2k', (0, 0) + self.size, 0,
|
||||
(self.codec, self.reduce, self.layers, fd, length, self.fp))]
|
||||
(self.codec, self.reduce, self.layers, fd, length))]
|
||||
|
||||
def load(self):
|
||||
if self.reduce:
|
||||
|
|
Loading…
Reference in New Issue
Block a user