# Path: testsuite/cases/base.py
# def rpartial(func, *args, **keywords):
#     """
#     right partial — same as functools.partial, but pass function args first
#     """
#     def newfunc(*fargs, **fkeywords):
#         newkeywords = keywords.copy()
#         newkeywords.update(fkeywords)
#         return func(*(fargs + args), **newkeywords)
#     newfunc.func = func
#     newfunc.args = args
#     newfunc.keywords = keywords
#     return newfunc
# 
# Path: testsuite/cases/pillow.py
# class PillowTestCase(BaseTestCase):
#     def create_test_data(self):
#     def resize(cls, self, size, resample=Image.NEAREST):
#     def gaussian_blur(cls, self, radius, n=3):
#     def getchannel(cls, self, channel):
#         L = math.sqrt(12.0 * float(radius) * radius / n + 1.0)


from .base import rpartial
from .pillow import PillowTestCase, Image, ImageFilter


class LutCase(PillowTestCase):
    def handle_args(self, channels, table_size):
        self.channels = channels
        self.table_size = table_size
        if channels == 3:
            mode, callback = 'RGB', lambda r, g, b: (r, g, b)
        elif channels == 4:
            mode, callback = 'RGBA', lambda r, g, b: (r, g, b, r)
        else:
            raise ValueError("Channels should 3 or 4.")


# Path: testsuite/cases/base.py
# def rpartial(func, *args, **keywords):
#     """
#     right partial — same as functools.partial, but pass function args first
#     """
#     def newfunc(*fargs, **fkeywords):
#         newkeywords = keywords.copy()
#         newkeywords.update(fkeywords)
#         return func(*(fargs + args), **newkeywords)
#     newfunc.func = func
#     newfunc.args = args
#     newfunc.keywords = keywords
#     return newfunc
# 
# Path: testsuite/cases/pillow.py
# class PillowTestCase(BaseTestCase):
#     def create_test_data(self):
#     def resize(cls, self, size, resample=Image.NEAREST):
#     def gaussian_blur(cls, self, radius, n=3):
#     def getchannel(cls, self, channel):
#         L = math.sqrt(12.0 * float(radius) * radius / n + 1.0)


# Path: testsuite/cases/pillow_lut.py
from .base import rpartial
from .pillow import PillowTestCase, Image, ImageFilter



class LutCase(PillowTestCase):
    def handle_args(self, channels, table_size):
        self.channels = channels
        self.table_size = table_size
        if channels == 3:
            mode, callback = 'RGB', lambda r, g, b: (r, g, b)
        elif channels == 4:
            mode, callback = 'RGBA', lambda r, g, b: (r, g, b, r)
        else:
            raise ValueError("Channels should 3 or 4.")


        self.lut = ImageFilter.Color3DLUT.generate(