This commit is contained in:
Hugo 2017-12-19 15:12:02 +02:00
parent c8eebc1dc7
commit 11a2026f12

View File

@ -22,7 +22,7 @@ class TestImage(PillowTestCase):
'BGR;15', 'BGR;16', 'BGR;24', 'BGR;32' 'BGR;15', 'BGR;16', 'BGR;24', 'BGR;32'
]: ]:
with self.assertRaises(ValueError) as e: with self.assertRaises(ValueError) as e:
Image.new(mode, (1, 1)); Image.new(mode, (1, 1))
self.assertEqual(str(e.exception), 'unrecognized image mode') self.assertEqual(str(e.exception), 'unrecognized image mode')
def test_sanity(self): def test_sanity(self):
@ -236,9 +236,9 @@ class TestImage(PillowTestCase):
self.assertEqual(img_colors, expected_colors) self.assertEqual(img_colors, expected_colors)
def test_alpha_inplace(self): def test_alpha_inplace(self):
src = Image.new('RGBA', (128,128), 'blue') src = Image.new('RGBA', (128, 128), 'blue')
over = Image.new('RGBA', (128,128), 'red') over = Image.new('RGBA', (128, 128), 'red')
mask = hopper('L') mask = hopper('L')
over.putalpha(mask) over.putalpha(mask)
@ -275,17 +275,18 @@ class TestImage(PillowTestCase):
# errors # errors
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, "invalid source") source.alpha_composite, over, "invalid source")
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, (0, 0), "invalid destination") source.alpha_composite, over, (0, 0),
"invalid destination")
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, (0)) source.alpha_composite, over, (0))
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, (0, 0), (0)) source.alpha_composite, over, (0, 0), (0))
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, (0, -1)) source.alpha_composite, over, (0, -1))
self.assertRaises(ValueError, self.assertRaises(ValueError,
source.alpha_composite, over, (0, 0), (0, -1)) source.alpha_composite, over, (0, 0), (0, -1))
def test_registered_extensions_uninitialized(self): def test_registered_extensions_uninitialized(self):
# Arrange # Arrange
@ -500,8 +501,8 @@ class TestImage(PillowTestCase):
im = hopper('RGB') im = hopper('RGB')
im_p = hopper('P') im_p = hopper('P')
blank_p = Image.new('P', (10,10)) blank_p = Image.new('P', (10, 10))
blank_pa = Image.new('PA', (10,10)) blank_pa = Image.new('PA', (10, 10))
blank_p.palette = None blank_p.palette = None
blank_pa.palette = None blank_pa.palette = None