diff --git a/Tests/test_file_spider.py b/Tests/test_file_spider.py index 622bfd624..65e4d2782 100644 --- a/Tests/test_file_spider.py +++ b/Tests/test_file_spider.py @@ -3,13 +3,13 @@ from helper import unittest, PillowTestCase, lena from PIL import Image from PIL import SpiderImagePlugin -test_file = "Tests/images/lena.spider" +TEST_FILE = "Tests/images/lena.spider" class TestImageSpider(PillowTestCase): def test_sanity(self): - im = Image.open(test_file) + im = Image.open(TEST_FILE) im.load() self.assertEqual(im.mode, "F") self.assertEqual(im.size, (128, 128)) @@ -30,7 +30,50 @@ class TestImageSpider(PillowTestCase): self.assertEqual(im2.format, "SPIDER") def test_isSpiderImage(self): - self.assertTrue(SpiderImagePlugin.isSpiderImage(test_file)) + self.assertTrue(SpiderImagePlugin.isSpiderImage(TEST_FILE)) + + def test_tell(self): + # Arrange + im = Image.open(TEST_FILE) + + # Act + index = im.tell() + + # Assert + self.assertEqual(index, 0) + + def test_loadImageSeries(self): + # Arrange + not_spider_file = "Tests/images/lena.ppm" + file_list = [TEST_FILE, not_spider_file, "path/not_found.ext"] + + # Act + img_list = SpiderImagePlugin.loadImageSeries(file_list) + + # Assert + self.assertEqual(len(img_list), 1) + self.assertIsInstance(img_list[0], Image.Image) + self.assertEqual(img_list[0].size, (128, 128)) + + def test_loadImageSeries_no_input(self): + # Arrange + file_list = None + + # Act + img_list = SpiderImagePlugin.loadImageSeries(file_list) + + # Assert + self.assertEqual(img_list, None) + + def test_isInt_not_a_number(self): + # Arrange + not_a_number = "a" + + # Act + ret = SpiderImagePlugin.isInt(not_a_number) + + # Assert + self.assertEqual(ret, 0) if __name__ == '__main__':