mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #799 from hugovk/SpiderImagePlugin
More tests for SpiderImagePlugin.py
This commit is contained in:
commit
37fdea2872
|
@ -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__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user