Pillow/Tests/test_file_xvthumb.py

28 lines
652 B
Python
Raw Normal View History

from helper import hopper, unittest, PillowTestCase
2017-03-01 12:20:18 +03:00
from PIL import Image, XVThumbImagePlugin
TEST_FILE = "Tests/images/hopper.p7"
2017-03-01 12:20:18 +03:00
class TestFileXVThumb(PillowTestCase):
def test_open(self):
# Act
im = Image.open(TEST_FILE)
# Assert
self.assertEqual(im.format, "XVThumb")
self.assert_image_similar(im, hopper("P"), 49)
2017-03-01 12:20:18 +03:00
def test_invalid_file(self):
invalid_file = "Tests/images/flower.jpg"
self.assertRaises(SyntaxError,
lambda:
XVThumbImagePlugin.XVThumbImageFile(invalid_file))
if __name__ == '__main__':
unittest.main()