mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Continuation line under-indented for visual indent
This commit is contained in:
parent
32cebddd1e
commit
c19d77abed
|
@ -38,47 +38,58 @@ class TestColorLut3DCoreAPI(PillowTestCase):
|
|||
im = Image.new('RGB', (10, 10), 0)
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "filter"):
|
||||
im.im.color_lut_3d('RGB', Image.CUBIC,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.CUBIC,
|
||||
*self.generate_identity_table(3, 3))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "image mode"):
|
||||
im.im.color_lut_3d('wrong', Image.LINEAR,
|
||||
im.im.color_lut_3d('wrong',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(3, 3))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "table_channels"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(5, 3))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "table_channels"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(1, 3))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "table_channels"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(2, 3))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "Table size"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(3, (1, 3, 3)))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "Table size"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
*self.generate_identity_table(3, (66, 3, 3)))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, r"size1D \* size2D \* size3D"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
3, 2, 2, 2, [0, 0, 0] * 7)
|
||||
|
||||
with self.assertRaisesRegex(ValueError, r"size1D \* size2D \* size3D"):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
3, 2, 2, 2, [0, 0, 0] * 9)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
3, 2, 2, 2, [0, 0, "0"] * 8)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
im.im.color_lut_3d('RGB', Image.LINEAR,
|
||||
im.im.color_lut_3d('RGB',
|
||||
Image.LINEAR,
|
||||
3, 2, 2, 2, 16)
|
||||
|
||||
def test_correct_args(self):
|
||||
|
@ -366,22 +377,23 @@ class TestColorLut3DFilter(PillowTestCase):
|
|||
lut = ImageFilter.Color3DLUT(
|
||||
(3, 4, 5), array('f', [0, 0, 0, 0] * (3 * 4 * 5)),
|
||||
channels=4, target_mode='YCbCr', _copy_table=False)
|
||||
self.assertEqual(repr(lut),
|
||||
self.assertEqual(
|
||||
repr(lut),
|
||||
"<Color3DLUT from array size=3x4x5 channels=4 target_mode=YCbCr>")
|
||||
|
||||
|
||||
class TestGenerateColorLut3D(PillowTestCase):
|
||||
def test_wrong_channels_count(self):
|
||||
with self.assertRaisesRegex(ValueError, "3 or 4 output channels"):
|
||||
ImageFilter.Color3DLUT.generate(5, channels=2,
|
||||
callback=lambda r, g, b: (r, g, b))
|
||||
ImageFilter.Color3DLUT.generate(
|
||||
5, channels=2, callback=lambda r, g, b: (r, g, b))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "should have either channels"):
|
||||
ImageFilter.Color3DLUT.generate(5, lambda r, g, b: (r, g, b, r))
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "should have either channels"):
|
||||
ImageFilter.Color3DLUT.generate(5, channels=4,
|
||||
callback=lambda r, g, b: (r, g, b))
|
||||
ImageFilter.Color3DLUT.generate(
|
||||
5, channels=4, callback=lambda r, g, b: (r, g, b))
|
||||
|
||||
def test_3_channels(self):
|
||||
lut = ImageFilter.Color3DLUT.generate(5, lambda r, g, b: (r, g, b))
|
||||
|
@ -392,8 +404,8 @@ class TestGenerateColorLut3D(PillowTestCase):
|
|||
1.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.25, 0.25, 0.0, 0.5, 0.25, 0.0])
|
||||
|
||||
def test_4_channels(self):
|
||||
lut = ImageFilter.Color3DLUT.generate(5, channels=4,
|
||||
callback=lambda r, g, b: (b, r, g, (r+g+b) / 2))
|
||||
lut = ImageFilter.Color3DLUT.generate(
|
||||
5, channels=4, callback=lambda r, g, b: (b, r, g, (r+g+b) / 2))
|
||||
self.assertEqual(tuple(lut.size), (5, 5, 5))
|
||||
self.assertEqual(lut.name, "Color 3D LUT")
|
||||
self.assertEqual(lut.table[:24], [
|
||||
|
|
Loading…
Reference in New Issue
Block a user