# Path: rmr/utils/patch.py
# @contextlib.contextmanager
# def patch(obj, attr, value, default=None):
#     """
#     Context manager inside of which `obj`'s `attr` will be equal `value`
#     """
#     original = getattr(obj, attr, default)
#     setattr(obj, attr, value)
#     yield
#     setattr(obj, attr, original)


import warnings
from django import test, http
from rmr.utils.patch import patch
    return _decorator


class Parametrized(type):

    def __new__(mcs, name, mro, attrs):
        warnings.warn(
            'Parametrized metaclass is deprecated and will be removed '
            'in rmr-django 2.0, use unittest.TestCase.subTest instead',
            category=RuntimeWarning, stacklevel=2,
        )

        actual_attrs = {}
        for method_name, method in attrs.items():
            data_sets = getattr(method, '__data_sets__', None)
            if not data_sets:
                actual_attrs[method_name] = method
                continue
            for data_set in data_sets:
                test_name = '{}_{}'.format(method_name, data_set)
                actual_attrs[test_name] = (lambda m, ds: (
                    lambda self: m(self, *ds.args, **ds.kwargs)
                ))(method, data_set)
        return super().__new__(mcs, name, mro, actual_attrs)


class Client(test.Client):

    def request(self, **request):
        with patch(http.HttpResponse, 'wsgi_request', _dummy_setter):

# Path: rmr/utils/patch.py
# @contextlib.contextmanager
# def patch(obj, attr, value, default=None):
#     """
#     Context manager inside of which `obj`'s `attr` will be equal `value`
#     """
#     original = getattr(obj, attr, default)
#     setattr(obj, attr, value)
#     yield
#     setattr(obj, attr, original)


# Path: rmr/utils/test.py
import warnings
from django import test, http
from rmr.utils.patch import patch

    return _decorator


class Parametrized(type):

    def __new__(mcs, name, mro, attrs):
        warnings.warn(
            'Parametrized metaclass is deprecated and will be removed '
            'in rmr-django 2.0, use unittest.TestCase.subTest instead',
            category=RuntimeWarning, stacklevel=2,
        )

        actual_attrs = {}
        for method_name, method in attrs.items():
            data_sets = getattr(method, '__data_sets__', None)
            if not data_sets:
                actual_attrs[method_name] = method
                continue
            for data_set in data_sets:
                test_name = '{}_{}'.format(method_name, data_set)
                actual_attrs[test_name] = (lambda m, ds: (
                    lambda self: m(self, *ds.args, **ds.kwargs)
                ))(method, data_set)
        return super().__new__(mcs, name, mro, actual_attrs)


class Client(test.Client):

    def request(self, **request):
        with patch(http.HttpResponse, 'wsgi_request', _dummy_setter):

            with patch(http.HttpResponse, 'request', _dummy_setter):