# 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
# 
# def root(*chunks):
#     return os.path.abspath(os.path.join(
#         os.path.dirname(__file__), '..', *chunks))
# 
# class FullCycleBaseCase(BaseTestCase):
#     def handle_args(self, level, name, filename, filetype):
#         self.level = level
#         self.name = name
#         self.filename = filename
#         self.filetype = filetype
# 
#     def create_test_data(self):
#         return ()
# 
#     def readable_args(self):
#         return [self.name]
# 
# Path: testsuite/cases/wand.py
# class WandTestCase(BaseTestCase):
#     def __init__(self, *args, **kwargs):
#     def create_test_data(self):
#     def __del__(self):
#     def blur(self, radius, sigma):
#     def hald_lut(self, hald_image):


from io import BytesIO
from .base import rpartial, root, FullCycleBaseCase
from .wand import WandTestCase, Image



class FullCycleCase(FullCycleBaseCase, WandTestCase):
    def runner(self):
        with Image(filename=root('resources', self.filename)) as im:
            if self.level > 0:
                im.rotate(degree=90.0)

            if self.level > 1:
                size = (int(im.width * 0.4 + 0.5),
                        int(im.height * 0.4 + 0.5))
                im.resize(size[0], size[1], 'catrom')

            if self.level > 2:
                self.blur(im, 2.5 * 4, 4)

            im.compression_quality = 85
            im.format = self.filetype
            im.save(file=BytesIO())
            # im.save(filename='../_out.{}.wand.png'.format(self.level))


cases = [

# 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
# 
# def root(*chunks):
#     return os.path.abspath(os.path.join(
#         os.path.dirname(__file__), '..', *chunks))
# 
# class FullCycleBaseCase(BaseTestCase):
#     def handle_args(self, level, name, filename, filetype):
#         self.level = level
#         self.name = name
#         self.filename = filename
#         self.filetype = filetype
# 
#     def create_test_data(self):
#         return ()
# 
#     def readable_args(self):
#         return [self.name]
# 
# Path: testsuite/cases/wand.py
# class WandTestCase(BaseTestCase):
#     def __init__(self, *args, **kwargs):
#     def create_test_data(self):
#     def __del__(self):
#     def blur(self, radius, sigma):
#     def hald_lut(self, hald_image):


# Path: testsuite/cases/wand_full_cycle.py
from io import BytesIO
from .base import rpartial, root, FullCycleBaseCase
from .wand import WandTestCase, Image




class FullCycleCase(FullCycleBaseCase, WandTestCase):
    def runner(self):
        with Image(filename=root('resources', self.filename)) as im:
            if self.level > 0:
                im.rotate(degree=90.0)

            if self.level > 1:
                size = (int(im.width * 0.4 + 0.5),
                        int(im.height * 0.4 + 0.5))
                im.resize(size[0], size[1], 'catrom')

            if self.level > 2:
                self.blur(im, 2.5 * 4, 4)

            im.compression_quality = 85
            im.format = self.filetype
            im.save(file=BytesIO())
            # im.save(filename='../_out.{}.wand.png'.format(self.level))


cases = [

    rpartial(FullCycleCase, 0, 'Load+save', 'pineapple.jpeg', 'JPEG'),