mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Refactor and test matrix convert with RGB and L modes
This commit is contained in:
parent
cea36587ab
commit
90dac5f4dc
|
@ -150,7 +150,9 @@ class TestImageConvert(PillowTestCase):
|
||||||
self.assertRaises(ValueError,
|
self.assertRaises(ValueError,
|
||||||
lambda: im.convert(mode='CMYK', matrix=matrix))
|
lambda: im.convert(mode='CMYK', matrix=matrix))
|
||||||
|
|
||||||
def test_matrix(self):
|
def test_matrix_rgb(self):
|
||||||
|
|
||||||
|
def matrix_convert(mode):
|
||||||
# Arrange
|
# Arrange
|
||||||
im = hopper('RGB')
|
im = hopper('RGB')
|
||||||
matrix = (
|
matrix = (
|
||||||
|
@ -161,12 +163,14 @@ class TestImageConvert(PillowTestCase):
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
# Convert an RGB image to the CIE XYZ colour space
|
# Convert an RGB image to the CIE XYZ colour space
|
||||||
converted_im = im.convert(mode='RGB', matrix=matrix)
|
converted_im = im.convert(mode=mode, matrix=matrix)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
self.assertEqual(converted_im.mode, 'RGB')
|
self.assertEqual(converted_im.mode, mode)
|
||||||
self.assertEqual(converted_im.size, im.size)
|
self.assertEqual(converted_im.size, im.size)
|
||||||
|
|
||||||
|
matrix_convert('RGB')
|
||||||
|
matrix_convert('L')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user