From c7339c244e0254e9c648efd686877657d9df1d88 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 13 Jul 2015 23:37:44 +1000 Subject: [PATCH] Added additional tests for TiffImagePlugin --- Tests/test_file_tiff.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index e1702bcfe..08f1f1880 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -82,6 +82,13 @@ class TestFileTiff(PillowTestCase): im._setup() self.assertEqual(im.info['dpi'], (72., 72.)) + def test_invalid_file(self): + invalid_file = "Tests/images/flower.jpg" + + self.assertRaises(SyntaxError, + lambda: TiffImagePlugin.TiffImageFile(invalid_file)) + + def test_bad_exif(self): try: Image.open('Tests/images/hopper_bad_exif.jpg')._getexif() @@ -89,6 +96,12 @@ class TestFileTiff(PillowTestCase): self.fail( "Bad EXIF data passed incorrect values to _binary unpack") + def test_save_unsupported_mode(self): + im = hopper("HSV") + outfile = self.tempfile("temp.tif") + + self.assertRaises(IOError, lambda: im.save(outfile)) + def test_little_endian(self): im = Image.open('Tests/images/16bit.cropped.tif') self.assertEqual(im.getpixel((0, 0)), 480)