mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Add repr for Color3DLUT
This commit is contained in:
parent
fb1d25417e
commit
75c76d91e1
|
@ -1,5 +1,7 @@
|
|||
from __future__ import division
|
||||
|
||||
from array import array
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
from helper import unittest, PillowTestCase
|
||||
|
||||
|
@ -264,8 +266,18 @@ class TestColorLut3DFilter(PillowTestCase):
|
|||
self.assertEqual(lut.table, list(range(24)))
|
||||
|
||||
lut = ImageFilter.Color3DLUT((2, 2, 2), [(0, 1, 2, 3)] * 8,
|
||||
channels=4)
|
||||
channels=4)
|
||||
|
||||
def test_repr(self):
|
||||
lut = ImageFilter.Color3DLUT(2, [0, 1, 2] * 8)
|
||||
self.assertEqual(repr(lut),
|
||||
"<Color3DLUT from list size=2x2x2 channels=3>")
|
||||
|
||||
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),
|
||||
"<Color3DLUT from array size=3x4x5 channels=4 target_mode=YCbCr>")
|
||||
|
||||
class TestGenerateColorLut3D(PillowTestCase):
|
||||
def test_wrong_channels_count(self):
|
||||
|
|
|
@ -442,6 +442,15 @@ class Color3DLUT(MultibandFilter):
|
|||
target_mode=target_mode or self.mode,
|
||||
_copy_table=False)
|
||||
|
||||
def __repr__(self):
|
||||
r = ["{0} from {1}".format(self.__class__.__name__,
|
||||
self.table.__class__.__name__)]
|
||||
r.append("size={0}x{1}x{2}".format(*self.size))
|
||||
r.append("channels={0}".format(self.channels))
|
||||
if self.mode:
|
||||
r.append("target_mode={0}".format(self.mode))
|
||||
return "<{}>".format(" ".join(r))
|
||||
|
||||
def filter(self, image):
|
||||
from . import Image
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user