mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Test pixar for similarity
This commit is contained in:
parent
c9e139e260
commit
49815f8d4a
|
@ -24,6 +24,7 @@ from ._binary import i16le as i16
|
|||
|
||||
__version__ = "0.1"
|
||||
|
||||
|
||||
#
|
||||
# helpers
|
||||
|
||||
|
@ -61,6 +62,7 @@ class PixarImageFile(ImageFile.ImageFile):
|
|||
# create tile descriptor (assuming "dumped")
|
||||
self.tile = [("raw", (0, 0)+self.size, 1024, (self.mode, 0, 1))]
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
30
Tests/test_file_pixar.py
Normal file
30
Tests/test_file_pixar.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from helper import hopper, unittest, PillowTestCase
|
||||
|
||||
from PIL import Image, PixarImagePlugin
|
||||
|
||||
# sample ppm stream
|
||||
TEST_FILE = "Tests/images/hopper.pxr"
|
||||
|
||||
|
||||
class TestImagePsd(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
im.load()
|
||||
self.assertEqual(im.mode, "RGB")
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
self.assertEqual(im.format, "PIXAR")
|
||||
|
||||
im2 = hopper()
|
||||
self.assert_image_similar(im, im2, 4.8)
|
||||
|
||||
def test_invalid_file(self):
|
||||
invalid_file = "Tests/images/flower.jpg"
|
||||
|
||||
self.assertRaises(
|
||||
SyntaxError,
|
||||
lambda: PixarImagePlugin.PixarImageFile(invalid_file))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user