# 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/wand.py
# class WandTestCase(BaseTestCase):
#     filter_ids = {
#         'lanczos': 'lzs', 'triangle': 'bil', 'catrom': 'bic', 'hamming': 'hmn',
#     }
# 
#     def __init__(self, *args, **kwargs):
#         self._free_resources = []
#         super().__init__(*args, **kwargs)
# 
#     def create_test_data(self):
#         im = Image(filename=root('resources', 'color_circle.png'))
#         if self.mode == 'RGB':
#             im.type = 'truecolor'
#         elif self.mode == 'RGBA':
#             im.type = 'truecolormatte'
#         elif self.mode == 'L':
#             im.type = 'grayscale'
#         elif self.mode in 'LA':
#             im.type = 'grayscalematte'
#         else:
#             raise ValueError('Unknown mode: {}'.format(self.mode))
#         im.resize(self.size[0], self.size[1], 'catrom')
#         self._free_resources.append(im)
#         return [im]
# 
#     def __del__(self):
#         for resource in self._free_resources:
#             resource.destroy()
# 
#     @staticmethod
#     @manipulative
#     def blur(self, radius, sigma):
#         if not isinstance(radius, numbers.Real):
#             raise TypeError('radius has to be a numbers.Real, not ' +
#                             repr(radius))
#         elif not isinstance(sigma, numbers.Real):
#             raise TypeError('sigma has to be a numbers.Real, not ' +
#                             repr(sigma))
#         r = library.MagickBlurImage(self.wand, radius, sigma)
#         if not r:
#             self.raise_exception()
# 
#     @staticmethod
#     @manipulative
#     def hald_lut(self, hald_image):
#         r = library.MagickHaldClutImage(self.wand, hald_image.resource)
#         if not r:
#             self.raise_exception()


from .base import rpartial
from .wand import WandTestCase


class BlurCase(WandTestCase):
    def handle_args(self, radius):
        self.radius = radius

    def runner(self, im):
        with im.clone() as im:
            self.blur(im, 2.5 * self.radius, self.radius)

    def readable_args(self):
        return ["{}px".format(self.radius)]


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
# 
# Path: testsuite/cases/wand.py
# class WandTestCase(BaseTestCase):
#     filter_ids = {
#         'lanczos': 'lzs', 'triangle': 'bil', 'catrom': 'bic', 'hamming': 'hmn',
#     }
# 
#     def __init__(self, *args, **kwargs):
#         self._free_resources = []
#         super().__init__(*args, **kwargs)
# 
#     def create_test_data(self):
#         im = Image(filename=root('resources', 'color_circle.png'))
#         if self.mode == 'RGB':
#             im.type = 'truecolor'
#         elif self.mode == 'RGBA':
#             im.type = 'truecolormatte'
#         elif self.mode == 'L':
#             im.type = 'grayscale'
#         elif self.mode in 'LA':
#             im.type = 'grayscalematte'
#         else:
#             raise ValueError('Unknown mode: {}'.format(self.mode))
#         im.resize(self.size[0], self.size[1], 'catrom')
#         self._free_resources.append(im)
#         return [im]
# 
#     def __del__(self):
#         for resource in self._free_resources:
#             resource.destroy()
# 
#     @staticmethod
#     @manipulative
#     def blur(self, radius, sigma):
#         if not isinstance(radius, numbers.Real):
#             raise TypeError('radius has to be a numbers.Real, not ' +
#                             repr(radius))
#         elif not isinstance(sigma, numbers.Real):
#             raise TypeError('sigma has to be a numbers.Real, not ' +
#                             repr(sigma))
#         r = library.MagickBlurImage(self.wand, radius, sigma)
#         if not r:
#             self.raise_exception()
# 
#     @staticmethod
#     @manipulative
#     def hald_lut(self, hald_image):
#         r = library.MagickHaldClutImage(self.wand, hald_image.resource)
#         if not r:
#             self.raise_exception()


# Path: testsuite/cases/wand_blur.py
from .base import rpartial
from .wand import WandTestCase



class BlurCase(WandTestCase):
    def handle_args(self, radius):
        self.radius = radius

    def runner(self, im):
        with im.clone() as im:
            self.blur(im, 2.5 * self.radius, self.radius)

    def readable_args(self):
        return ["{}px".format(self.radius)]


cases = [

    rpartial(BlurCase, radius)