From dabb68a61e3f3a890286573d2c1bdb758ea9cbfe Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 4 Apr 2016 18:48:21 +1000 Subject: [PATCH] Added tests --- Tests/test_file_spider.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/test_file_spider.py b/Tests/test_file_spider.py index 53cf3915b..956063167 100644 --- a/Tests/test_file_spider.py +++ b/Tests/test_file_spider.py @@ -1,6 +1,7 @@ from helper import unittest, PillowTestCase, hopper from PIL import Image +from PIL import ImageSequence from PIL import SpiderImagePlugin TEST_FILE = "Tests/images/hopper.spider" @@ -85,6 +86,17 @@ class TestImageSpider(PillowTestCase): self.assertRaises(IOError, lambda: Image.open(invalid_file)) + def test_nonstack_file(self): + im = Image.open(TEST_FILE) + + self.assertRaises(EOFError, lambda: im.seek(0)) + + def test_nonstack_dos(self): + im = Image.open(TEST_FILE) + for i, frame in enumerate(ImageSequence.Iterator(im)): + if i > 1: + self.fail("Non-stack DOS file test failed") + if __name__ == '__main__': unittest.main()