Skip to content

back to Claude Sonnet 3.5 - Fill-in summary

Claude Sonnet 3.5 - Fill-in: deprecated

Pytest Summary for test tests

status count
passed 80
error 10
failed 81
total 171
collected 171

Failed pytests:

test_deprecated.py::test_classic_deprecated_function__warns[None]

test_deprecated.py::test_classic_deprecated_function__warns[None]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_function(request):
        if request.param is None:

            @deprecated.classic.deprecated
>           def foo1():

tests/test_deprecated.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.foo1 at 0x7f31455cf400>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function1]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function1]
classic_deprecated_function = .foo1 at 0x7f31453356c0>

    def test_classic_deprecated_function__warns(classic_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:135: AssertionError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function2]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function2]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_function(request):
        if request.param is None:

            @deprecated.classic.deprecated
            def foo1():
                pass

            return foo1
        else:
            args, kwargs = request.param

>           @deprecated.classic.deprecated(*args, **kwargs)

tests/test_deprecated.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('Good reason',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function3]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function3]
classic_deprecated_function = .foo1 at 0x7f3145335cf0>

    def test_classic_deprecated_function__warns(classic_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:135: AssertionError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function4]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function4]
classic_deprecated_function = .foo1 at 0x7f3145335ea0>

    def test_classic_deprecated_function__warns(classic_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:135: AssertionError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function5]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function5]
classic_deprecated_function = .foo1 at 0x7f3145334a60>

    def test_classic_deprecated_function__warns(classic_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:135: AssertionError

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function6]

test_deprecated.py::test_classic_deprecated_function__warns[classic_deprecated_function6]
classic_deprecated_function = .foo1 at 0x7f3145336050>

    def test_classic_deprecated_function__warns(classic_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:135: AssertionError

test_deprecated.py::test_classic_deprecated_class__warns[None]

test_deprecated.py::test_classic_deprecated_class__warns[None]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_class(request):
        if request.param is None:

            @deprecated.classic.deprecated
>           class Foo2(object):

tests/test_deprecated.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.Foo2'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_class__warns[classic_deprecated_class2]

test_deprecated.py::test_classic_deprecated_class__warns[classic_deprecated_class2]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_class(request):
        if request.param is None:

            @deprecated.classic.deprecated
            class Foo2(object):
                pass

            return Foo2
        else:
            args, kwargs = request.param

>           @deprecated.classic.deprecated(*args, **kwargs)

tests/test_deprecated.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('Good reason',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_method__warns[None]

test_deprecated.py::test_classic_deprecated_method__warns[None]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_method(request):
        if request.param is None:

>           class Foo3(object):

tests/test_deprecated.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:69: in Foo3
    def foo3(self):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.Foo3.foo3 at 0x7f3145335750>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method1]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method1]
classic_deprecated_method = .Foo3'>

    def test_classic_deprecated_method__warns(classic_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = classic_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:160: AssertionError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method2]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method2]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_method(request):
        if request.param is None:

            class Foo3(object):
                @deprecated.classic.deprecated
                def foo3(self):
                    pass

            return Foo3
        else:
            args, kwargs = request.param

>           class Foo3(object):

tests/test_deprecated.py:76: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:77: in Foo3
    @deprecated.classic.deprecated(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('Good reason',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method3]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method3]
classic_deprecated_method = .Foo3'>

    def test_classic_deprecated_method__warns(classic_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = classic_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:160: AssertionError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method4]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method4]
classic_deprecated_method = .Foo3'>

    def test_classic_deprecated_method__warns(classic_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = classic_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:160: AssertionError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method5]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method5]
classic_deprecated_method = .Foo3'>

    def test_classic_deprecated_method__warns(classic_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = classic_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:160: AssertionError

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method6]

test_deprecated.py::test_classic_deprecated_method__warns[classic_deprecated_method6]
classic_deprecated_method = .Foo3'>

    def test_classic_deprecated_method__warns(classic_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = classic_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:160: AssertionError

test_deprecated.py::test_classic_deprecated_static_method__warns[None]

test_deprecated.py::test_classic_deprecated_static_method__warns[None]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_static_method(request):
        if request.param is None:

>           class Foo4(object):

tests/test_deprecated.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:91: in Foo4
    def foo4():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.Foo4.foo4 at 0x7f3145335d80>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method1]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method1]
classic_deprecated_static_method = .Foo4.foo4 at 0x7f3145337640>

    def test_classic_deprecated_static_method__warns(classic_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:172: AssertionError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method2]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method2]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_static_method(request):
        if request.param is None:

            class Foo4(object):
                @staticmethod
                @deprecated.classic.deprecated
                def foo4():
                    pass

            return Foo4.foo4
        else:
            args, kwargs = request.param

>           class Foo4(object):

tests/test_deprecated.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:100: in Foo4
    @deprecated.classic.deprecated(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('Good reason',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method3]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method3]
classic_deprecated_static_method = .Foo4.foo4 at 0x7f3145337f40>

    def test_classic_deprecated_static_method__warns(classic_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:172: AssertionError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method4]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method4]
classic_deprecated_static_method = .Foo4.foo4 at 0x7f3145337910>

    def test_classic_deprecated_static_method__warns(classic_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:172: AssertionError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method5]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method5]
classic_deprecated_static_method = .Foo4.foo4 at 0x7f3145336e60>

    def test_classic_deprecated_static_method__warns(classic_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:172: AssertionError

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method6]

test_deprecated.py::test_classic_deprecated_static_method__warns[classic_deprecated_static_method6]
classic_deprecated_static_method = .Foo4.foo4 at 0x7f31453370a0>

    def test_classic_deprecated_static_method__warns(classic_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            classic_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:172: AssertionError

test_deprecated.py::test_classic_deprecated_class_method__warns[None]

test_deprecated.py::test_classic_deprecated_class_method__warns[None]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_class_method(request):
        if request.param is None:

>           class Foo5(object):

tests/test_deprecated.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:114: in Foo5
    def foo5(cls):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.Foo5.foo5 at 0x7f3145337010>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method1]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method1]
classic_deprecated_class_method = .Foo5'>

    def test_classic_deprecated_class_method__warns(classic_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = classic_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:185: AssertionError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method2]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method2]
request = >

    @pytest.fixture(scope="module", params=_PARAMS)
    def classic_deprecated_class_method(request):
        if request.param is None:

            class Foo5(object):
                @classmethod
                @deprecated.classic.deprecated
                def foo5(cls):
                    pass

            return Foo5
        else:
            args, kwargs = request.param

>           class Foo5(object):

tests/test_deprecated.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_deprecated.py:123: in Foo5
    @deprecated.classic.deprecated(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('Good reason',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method3]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method3]
classic_deprecated_class_method = .Foo5'>

    def test_classic_deprecated_class_method__warns(classic_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = classic_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:185: AssertionError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method4]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method4]
classic_deprecated_class_method = .Foo5'>

    def test_classic_deprecated_class_method__warns(classic_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = classic_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:185: AssertionError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method5]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method5]
classic_deprecated_class_method = .Foo5'>

    def test_classic_deprecated_class_method__warns(classic_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = classic_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:185: AssertionError

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method6]

test_deprecated.py::test_classic_deprecated_class_method__warns[classic_deprecated_class_method6]
classic_deprecated_class_method = .Foo5'>

    def test_classic_deprecated_class_method__warns(classic_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = classic_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:185: AssertionError

test_deprecated.py::test_should_raise_type_error

test_deprecated.py::test_should_raise_type_error
def test_should_raise_type_error():
        try:
>           deprecated.classic.deprecated(5)

tests/test_deprecated.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (5,), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated.py::test_warning_msg_has_reason

test_deprecated.py::test_warning_msg_has_reason
def test_warning_msg_has_reason():
        reason = "Good reason"

        @deprecated.classic.deprecated(reason=reason)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_deprecated.py:212: IndexError

test_deprecated.py::test_warning_msg_has_version

test_deprecated.py::test_warning_msg_has_version
def test_warning_msg_has_version():
        version = "1.2.3"

        @deprecated.classic.deprecated(version=version)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_deprecated.py:225: IndexError

test_deprecated.py::test_specific_warning_cls_is_used

test_deprecated.py::test_specific_warning_cls_is_used
def test_specific_warning_cls_is_used():
        @deprecated.classic.deprecated(category=MyDeprecationWarning)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_deprecated.py:246: IndexError

test_deprecated.py::test_respect_global_filter

test_deprecated.py::test_respect_global_filter
def test_respect_global_filter():
        @deprecated.classic.deprecated(version='1.2.1', reason="deprecated function")
        def fun():
            print("fun")

        warnings.simplefilter("once", category=DeprecationWarning)

        with warnings.catch_warnings(record=True) as warns:
            fun()
            fun()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_deprecated.py:260: AssertionError

test_deprecated_class.py::test_class_deprecation_using_deprecated_decorator

test_deprecated_class.py::test_class_deprecation_using_deprecated_decorator
def test_class_deprecation_using_deprecated_decorator():
        @deprecated.classic.deprecated
>       class MyBaseClass(object):

tests/test_deprecated_class.py:93: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyBaseClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_class.py::test_class_respect_global_filter

test_deprecated_class.py::test_class_respect_global_filter
def test_class_respect_global_filter():
        @deprecated.classic.deprecated
>       class MyBaseClass(object):

tests/test_deprecated_class.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyBaseClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_class.py::test_subclass_deprecation_using_deprecated_decorator

test_deprecated_class.py::test_subclass_deprecation_using_deprecated_decorator
def test_subclass_deprecation_using_deprecated_decorator():
        @deprecated.classic.deprecated
>       class MyBaseClass(object):

tests/test_deprecated_class.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyBaseClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_class.py::test_simple_class_deprecation_with_args

test_deprecated_class.py::test_simple_class_deprecation_with_args
def test_simple_class_deprecation_with_args():
>       @deprecated.classic.deprecated('kwargs class')

tests/test_deprecated_class.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ('kwargs class',), kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_metaclass.py::test_with_init

test_deprecated_metaclass.py::test_with_init
def test_with_init():
        @deprecated.classic.deprecated
>       class MyClass(object):

tests/test_deprecated_metaclass.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_metaclass.py::test_with_new

test_deprecated_metaclass.py::test_with_new
def test_with_new():
        @deprecated.classic.deprecated
>       class MyClass(object):

tests/test_deprecated_metaclass.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_metaclass.py::test_with_metaclass

test_deprecated_metaclass.py::test_with_metaclass
def test_with_metaclass():
        class Meta(type):
            def __call__(cls, *args, **kwargs):
                obj = super(Meta, cls).__call__(*args, **kwargs)
                obj.c = 3.14
                return obj

        @deprecated.classic.deprecated
>       class MyClass(with_metaclass(Meta)):

tests/test_deprecated_metaclass.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_deprecated_metaclass.py::test_with_singleton_metaclass

test_deprecated_metaclass.py::test_with_singleton_metaclass
def test_with_singleton_metaclass():
        class Singleton(type):
            _instances = {}

            def __call__(cls, *args, **kwargs):
                if cls not in cls._instances:
                    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
                return cls._instances[cls]

        @deprecated.classic.deprecated
>       class MyClass(with_metaclass(Singleton)):

tests/test_deprecated_metaclass.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_sphinx.py::test_has_sphinx_docstring[short_docstring-deprecated-reason&version]

test_sphinx.py::test_has_sphinx_docstring[short_docstring-deprecated-reason&version]
docstring = 'This function adds *x* and *y*.', directive = 'deprecated'
reason = 'A good reason', version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n   A good reason\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[short_docstring-deprecated-version]

test_sphinx.py::test_has_sphinx_docstring[short_docstring-deprecated-version]
docstring = 'This function adds *x* and *y*.', directive = 'deprecated'
reason = None, version = '1.2.0', expected = '.. deprecated:: 1.2.0\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[no_docstring-deprecated-reason&version]

test_sphinx.py::test_has_sphinx_docstring[no_docstring-deprecated-reason&version]
docstring = None, directive = 'deprecated', reason = 'A good reason'
version = '1.2.0', expected = '.. deprecated:: 1.2.0\n   A good reason\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[no_docstring-deprecated-version]

test_sphinx.py::test_has_sphinx_docstring[no_docstring-deprecated-version]
docstring = None, directive = 'deprecated', reason = None, version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[D213_long_docstring-deprecated-reason&version]

test_sphinx.py::test_has_sphinx_docstring[D213_long_docstring-deprecated-reason&version]
docstring = '\n        This function adds *x* and *y*.\n\n        :param x: number *x*\n        :param y: number *y*\n        :return: sum = *x* + *y*\n        '
directive = 'deprecated', reason = 'A good reason', version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n   A good reason\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[D213_long_docstring-deprecated-version]

test_sphinx.py::test_has_sphinx_docstring[D213_long_docstring-deprecated-version]
docstring = '\n        This function adds *x* and *y*.\n\n        :param x: number *x*\n        :param y: number *y*\n        :return: sum = *x* + *y*\n        '
directive = 'deprecated', reason = None, version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[D212_long_docstring-deprecated-reason&version]

test_sphinx.py::test_has_sphinx_docstring[D212_long_docstring-deprecated-reason&version]
docstring = 'This function adds *x* and *y*.\n\n        :param x: number *x*\n        :param y: number *y*\n        :return: sum = *x* + *y*\n        '
directive = 'deprecated', reason = 'A good reason', version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n   A good reason\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_has_sphinx_docstring[D212_long_docstring-deprecated-version]

test_sphinx.py::test_has_sphinx_docstring[D212_long_docstring-deprecated-version]
docstring = 'This function adds *x* and *y*.\n\n        :param x: number *x*\n        :param y: number *y*\n        :return: sum = *x* + *y*\n        '
directive = 'deprecated', reason = None, version = '1.2.0'
expected = '.. deprecated:: 1.2.0\n'

    @pytest.mark.parametrize(
        "reason, version, expected",
        [
            (
                'A good reason',
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                       {reason}
                    """
                ),
            ),
            (
                None,
                '1.2.0',
                textwrap.dedent(
                    """\
                    .. {directive}:: {version}
                    """
                ),
            ),
        ],
        ids=["reason&version", "version"],
    )
    def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
        # The function:
        def foo(x, y):
            return x + y

        # with docstring:
        foo.__doc__ = docstring

        # is decorated with:
        decorator_factory = getattr(deprecated.sphinx, directive)
        decorator = decorator_factory(reason=reason, version=version)
        foo = decorator(foo)

        # The function must contains this Sphinx docstring:
        expected = expected.format(directive=directive, version=version, reason=reason)

        current = textwrap.dedent(foo.__doc__)
        assert current.endswith(expected)

        current = current.replace(expected, '')
        if docstring:
            # An empty line must separate the original docstring and the directive.
            assert re.search("\n[ ]*\n$", current, flags=re.DOTALL)
        else:
            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
            assert current == "\n"

        with warnings.catch_warnings(record=True) as warns:
            foo(1, 2)

        if directive in {'versionadded', 'versionchanged'}:
            # don't emit DeprecationWarning
            assert len(warns) == 0
        else:
            # emit DeprecationWarning
>           assert len(warns) == 1
E           assert 0 == 1
E            +  where 0 = len([])

tests/test_sphinx.py:105: AssertionError

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function0]

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function0]
sphinx_deprecated_function = .foo1 at 0x7f31453bc9d0>

    def test_sphinx_deprecated_function__warns(sphinx_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:252: AssertionError

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function1]

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function1]
sphinx_deprecated_function = .foo1 at 0x7f31453bc310>

    def test_sphinx_deprecated_function__warns(sphinx_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:252: AssertionError

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function2]

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function2]
sphinx_deprecated_function = .foo1 at 0x7f31453bc4c0>

    def test_sphinx_deprecated_function__warns(sphinx_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:252: AssertionError

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function3]

test_sphinx.py::test_sphinx_deprecated_function__warns[sphinx_deprecated_function3]
sphinx_deprecated_function = .foo1 at 0x7f31453bc940>

    def test_sphinx_deprecated_function__warns(sphinx_deprecated_function):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_function()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:252: AssertionError

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method0]

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method0]
sphinx_deprecated_method = .Foo3'>

    def test_sphinx_deprecated_method__warns(sphinx_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = sphinx_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:278: AssertionError

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method1]

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method1]
sphinx_deprecated_method = .Foo3'>

    def test_sphinx_deprecated_method__warns(sphinx_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = sphinx_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:278: AssertionError

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method2]

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method2]
sphinx_deprecated_method = .Foo3'>

    def test_sphinx_deprecated_method__warns(sphinx_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = sphinx_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:278: AssertionError

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method3]

test_sphinx.py::test_sphinx_deprecated_method__warns[sphinx_deprecated_method3]
sphinx_deprecated_method = .Foo3'>

    def test_sphinx_deprecated_method__warns(sphinx_deprecated_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            obj = sphinx_deprecated_method()
            obj.foo3()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:278: AssertionError

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method0]

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method0]
sphinx_deprecated_static_method = .Foo4.foo4 at 0x7f31453bcd30>

    def test_sphinx_deprecated_static_method__warns(sphinx_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:289: AssertionError

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method1]

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method1]
sphinx_deprecated_static_method = .Foo4.foo4 at 0x7f31453bd090>

    def test_sphinx_deprecated_static_method__warns(sphinx_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:289: AssertionError

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method2]

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method2]
sphinx_deprecated_static_method = .Foo4.foo4 at 0x7f31453bd240>

    def test_sphinx_deprecated_static_method__warns(sphinx_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:289: AssertionError

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method3]

test_sphinx.py::test_sphinx_deprecated_static_method__warns[sphinx_deprecated_static_method3]
sphinx_deprecated_static_method = .Foo4.foo4 at 0x7f31453bd3f0>

    def test_sphinx_deprecated_static_method__warns(sphinx_deprecated_static_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            sphinx_deprecated_static_method()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:289: AssertionError

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method0]

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method0]
sphinx_deprecated_class_method = .Foo5'>

    def test_sphinx_deprecated_class_method__warns(sphinx_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = sphinx_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:301: AssertionError

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method1]

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method1]
sphinx_deprecated_class_method = .Foo5'>

    def test_sphinx_deprecated_class_method__warns(sphinx_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = sphinx_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:301: AssertionError

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method2]

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method2]
sphinx_deprecated_class_method = .Foo5'>

    def test_sphinx_deprecated_class_method__warns(sphinx_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = sphinx_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:301: AssertionError

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method3]

test_sphinx.py::test_sphinx_deprecated_class_method__warns[sphinx_deprecated_class_method3]
sphinx_deprecated_class_method = .Foo5'>

    def test_sphinx_deprecated_class_method__warns(sphinx_deprecated_class_method):
        with warnings.catch_warnings(record=True) as warns:
            warnings.simplefilter("always")
            cls = sphinx_deprecated_class_method()
            cls.foo5()
>       assert len(warns) == 1
E       assert 0 == 1
E        +  where 0 = len([])

tests/test_sphinx.py:301: AssertionError

test_sphinx.py::test_warning_msg_has_reason

test_sphinx.py::test_warning_msg_has_reason
def test_warning_msg_has_reason():
        reason = "Good reason"

        @deprecated.sphinx.deprecated(version="4.5.6", reason=reason)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_sphinx.py:330: IndexError

test_sphinx.py::test_warning_msg_has_version

test_sphinx.py::test_warning_msg_has_version
def test_warning_msg_has_version():
        version = "1.2.3"

        @deprecated.sphinx.deprecated(version=version)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_sphinx.py:343: IndexError

test_sphinx.py::test_specific_warning_cls_is_used

test_sphinx.py::test_specific_warning_cls_is_used
def test_specific_warning_cls_is_used():
        @deprecated.sphinx.deprecated(version="4.5.6", category=MyDeprecationWarning)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_sphinx.py:364: IndexError

test_sphinx.py::test_sphinx_syntax_trimming[Use :function:bar instead-Use bar instead]

test_sphinx.py::test_sphinx_syntax_trimming[Use :function:`bar` instead-Use `bar` instead]
reason = 'Use :function:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        ["reason", "expected"],
        [
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
        ],
    )
    def test_sphinx_syntax_trimming(reason, expected):
        @deprecated.sphinx.deprecated(version="4.5.6", reason=reason)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_sphinx.py:389: IndexError

test_sphinx.py::test_sphinx_syntax_trimming[Use :py:func:bar instead-Use bar instead]

test_sphinx.py::test_sphinx_syntax_trimming[Use :py:func:`bar` instead-Use `bar` instead]
reason = 'Use :py:func:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        ["reason", "expected"],
        [
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
        ],
    )
    def test_sphinx_syntax_trimming(reason, expected):
        @deprecated.sphinx.deprecated(version="4.5.6", reason=reason)
        def foo():
            pass

        with warnings.catch_warnings(record=True) as warns:
            foo()
>       warn = warns[0]
E       IndexError: list index out of range

tests/test_sphinx.py:389: IndexError

test_sphinx.py::test_get_deprecated_msg[Use :func:bar instead-Use bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :func:`bar` instead-Use `bar` instead]
reason = 'Use :func:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `bar` instead' in 'Call to deprecated function . (Use bar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :function:bar instead-Use bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :function:`bar` instead-Use `bar` instead]
reason = 'Use :function:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `bar` instead' in 'Call to deprecated function . (Use :function:`bar` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :class:Baz instead-Use Baz instead]

test_sphinx.py::test_get_deprecated_msg[Use :class:`Baz` instead-Use `Baz` instead]
reason = 'Use :class:`Baz` instead', expected = 'Use `Baz` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `Baz` instead' in 'Call to deprecated function . (Use Baz instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :exc:Baz instead-Use Baz instead]

test_sphinx.py::test_get_deprecated_msg[Use :exc:`Baz` instead-Use `Baz` instead]
reason = 'Use :exc:`Baz` instead', expected = 'Use `Baz` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `Baz` instead' in 'Call to deprecated function . (Use Baz instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :exception:Baz instead-Use Baz instead]

test_sphinx.py::test_get_deprecated_msg[Use :exception:`Baz` instead-Use `Baz` instead]
reason = 'Use :exception:`Baz` instead', expected = 'Use `Baz` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `Baz` instead' in 'Call to deprecated function . (Use :exception:`Baz` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :meth:Baz.bar instead-Use Baz.bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :meth:`Baz.bar` instead-Use `Baz.bar` instead]
reason = 'Use :meth:`Baz.bar` instead', expected = 'Use `Baz.bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `Baz.bar` instead' in 'Call to deprecated function . (Use Baz.bar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :method:Baz.bar instead-Use Baz.bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :method:`Baz.bar` instead-Use `Baz.bar` instead]
reason = 'Use :method:`Baz.bar` instead', expected = 'Use `Baz.bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `Baz.bar` instead' in 'Call to deprecated function . (Use :method:`Baz.bar` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :py:func:bar instead-Use bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :py:func:`bar` instead-Use `bar` instead]
reason = 'Use :py:func:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `bar` instead' in 'Call to deprecated function . (Use :pybar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :cpp:func:bar instead-Use bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :cpp:func:`bar` instead-Use `bar` instead]
reason = 'Use :cpp:func:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `bar` instead' in 'Call to deprecated function . (Use :cppbar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :js:func:bar instead-Use bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :js:func:`bar` instead-Use `bar` instead]
reason = 'Use :js:func:`bar` instead', expected = 'Use `bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `bar` instead' in 'Call to deprecated function . (Use :jsbar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :func:~pkg.mod.bar instead-Use ~pkg.mod.bar instead]

test_sphinx.py::test_get_deprecated_msg[Use :func:`~pkg.mod.bar` instead-Use `~pkg.mod.bar` instead]
reason = 'Use :func:`~pkg.mod.bar` instead'
expected = 'Use `~pkg.mod.bar` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `~pkg.mod.bar` instead' in 'Call to deprecated function . (Use pkg.mod.bar instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :r:instead-Use instead]

test_sphinx.py::test_get_deprecated_msg[Use :r:`` instead-Use `` instead]
reason = 'Use :r:`` instead', expected = 'Use `` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `` instead' in 'Call to deprecated function . (Use :r:`` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :d:r:instead-Use instead]

test_sphinx.py::test_get_deprecated_msg[Use :d:r:`` instead-Use `` instead]
reason = 'Use :d:r:`` instead', expected = 'Use `` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `` instead' in 'Call to deprecated function . (Use :d:r:`` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :r:foo instead-Use foo instead]

test_sphinx.py::test_get_deprecated_msg[Use :r:`foo` instead-Use `foo` instead]
reason = 'Use :r:`foo` instead', expected = 'Use `foo` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `foo` instead' in 'Call to deprecated function . (Use :r:`foo` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx.py::test_get_deprecated_msg[Use :d:r:foo instead-Use foo instead]

test_sphinx.py::test_get_deprecated_msg[Use :d:r:`foo` instead-Use `foo` instead]
reason = 'Use :d:r:`foo` instead', expected = 'Use `foo` instead'

    @pytest.mark.parametrize(
        "reason, expected",
        [
            # classic examples using the default domain (Python)
            ("Use :func:`bar` instead", "Use `bar` instead"),
            ("Use :function:`bar` instead", "Use `bar` instead"),
            ("Use :class:`Baz` instead", "Use `Baz` instead"),
            ("Use :exc:`Baz` instead", "Use `Baz` instead"),
            ("Use :exception:`Baz` instead", "Use `Baz` instead"),
            ("Use :meth:`Baz.bar` instead", "Use `Baz.bar` instead"),
            ("Use :method:`Baz.bar` instead", "Use `Baz.bar` instead"),
            # other examples using a domain :
            ("Use :py:func:`bar` instead", "Use `bar` instead"),
            ("Use :cpp:func:`bar` instead", "Use `bar` instead"),
            ("Use :js:func:`bar` instead", "Use `bar` instead"),
            # the reference can have special characters:
            ("Use :func:`~pkg.mod.bar` instead", "Use `~pkg.mod.bar` instead"),
            # edge cases:
            ("Use :r:`` instead", "Use `` instead"),
            ("Use :d:r:`` instead", "Use `` instead"),
            ("Use :r:`foo` instead", "Use `foo` instead"),
            ("Use :d:r:`foo` instead", "Use `foo` instead"),
            ("Use r:`bad` instead", "Use r:`bad` instead"),
            ("Use ::`bad` instead", "Use ::`bad` instead"),
            ("Use :::`bad` instead", "Use :::`bad` instead"),
        ],
    )
    def test_get_deprecated_msg(reason, expected):
        adapter = deprecated.sphinx.SphinxAdapter("deprecated", reason=reason, version="1")
        actual = adapter.get_deprecated_msg(lambda: None, None)
>       assert expected in actual
E       AssertionError: assert 'Use `foo` instead' in 'Call to deprecated function . (Use :d:r:`foo` instead) -- Deprecated since version 1.'

tests/test_sphinx.py:424: AssertionError

test_sphinx_metaclass.py::test_with_init

test_sphinx_metaclass.py::test_with_init
def test_with_init():
        @deprecated.classic.deprecated
>       class MyClass(object):

tests/test_sphinx_metaclass.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_sphinx_metaclass.py::test_with_new

test_sphinx_metaclass.py::test_with_new
def test_with_new():
        @deprecated.classic.deprecated
>       class MyClass(object):

tests/test_sphinx_metaclass.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_sphinx_metaclass.py::test_with_metaclass

test_sphinx_metaclass.py::test_with_metaclass
def test_with_metaclass():
        class Meta(type):
            def __call__(cls, *args, **kwargs):
                obj = super(Meta, cls).__call__(*args, **kwargs)
                obj.c = 3.14
                return obj

        @deprecated.classic.deprecated
>       class MyClass(with_metaclass(Meta)):

tests/test_sphinx_metaclass.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

test_sphinx_metaclass.py::test_with_singleton_metaclass

test_sphinx_metaclass.py::test_with_singleton_metaclass
def test_with_singleton_metaclass():
        class Singleton(type):
            _instances = {}

            def __call__(cls, *args, **kwargs):
                if cls not in cls._instances:
                    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
                return cls._instances[cls]

        @deprecated.classic.deprecated
>       class MyClass(with_metaclass(Singleton)):

tests/test_sphinx_metaclass.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (.MyClass'>,)
kwargs = {}

    def deprecated(*args, **kwargs):
        """
        This is a decorator which can be used to mark functions
        as deprecated. It will result in a warning being emitted
        when the function is used.

        **Classic usage:**

        To use this, decorate your deprecated function with **@deprecated** decorator:

        .. code-block:: python

           from deprecated import deprecated


           @deprecated
           def some_old_function(x, y):
               return x + y

        You can also decorate a class or a method:

        .. code-block:: python

           from deprecated import deprecated


           class SomeClass(object):
               @deprecated
               def some_old_method(self, x, y):
                   return x + y


           @deprecated
           class SomeOldClass(object):
               pass

        You can give a *reason* message to help the developer to choose another function/class,
        and a *version* number to specify the starting version number of the deprecation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(reason="use another function", version='1.2.0')
           def some_old_function(x, y):
               return x + y

        The *category* keyword argument allow you to specify the deprecation warning class of your choice.
        By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
        :exc:`PendingDeprecationWarning` or a custom subclass.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(category=PendingDeprecationWarning)
           def some_old_function(x, y):
               return x + y

        The *action* keyword argument allow you to locally change the warning filtering.
        *action* can be one of "error", "ignore", "always", "default", "module", or "once".
        If ``None``, empty or missing, the the global filtering mechanism is used.
        See: `The Warnings Filter`_ in the Python documentation.

        .. code-block:: python

           from deprecated import deprecated


           @deprecated(action="error")
           def some_old_function(x, y):
               return x + y

        """
>       if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
E       NameError: name 'types' is not defined

deprecated/classic.py:248: NameError

Patch diff

diff --git a/deprecated/classic.py b/deprecated/classic.py
index fc9af25..273dcec 100644
--- a/deprecated/classic.py
+++ b/deprecated/classic.py
@@ -119,7 +119,21 @@ class ClassicAdapter(wrapt.AdapterFactory):

         :return: The warning message.
         """
-        pass
+        if instance is None:
+            if inspect.isclass(wrapped):
+                fmt = "Call to deprecated class {name}."
+            else:
+                fmt = "Call to deprecated function {name}."
+        else:
+            if inspect.isclass(instance):
+                fmt = "Call to deprecated class method {name}."
+            else:
+                fmt = "Call to deprecated method {name}."
+        if self.reason:
+            fmt += " ({reason})"
+        if self.version:
+            fmt += " -- Deprecated since version {version}."
+        return fmt.format(name=wrapped.__name__, reason=self.reason, version=self.version)

     def __call__(self, wrapped):
         """
@@ -231,4 +245,9 @@ def deprecated(*args, **kwargs):
            return x + y

     """
-    pass
+    if args and isinstance(args[0], (type, types.FunctionType, types.MethodType)):
+        return ClassicAdapter()(args[0])
+    else:
+        def wrapper(wrapped):
+            return ClassicAdapter(**kwargs)(wrapped)
+        return wrapper
diff --git a/deprecated/sphinx.py b/deprecated/sphinx.py
index 6daf81f..5e8ed53 100644
--- a/deprecated/sphinx.py
+++ b/deprecated/sphinx.py
@@ -133,7 +133,13 @@ class SphinxAdapter(ClassicAdapter):
            Strip Sphinx cross-referencing syntax from warning message.

         """
-        pass
+        # Get the original deprecation message
+        message = super(SphinxAdapter, self).get_deprecated_msg(wrapped, instance)
+        
+        # Strip Sphinx cross-referencing syntax
+        message = re.sub(r':(?:class|func|meth|attr|obj|exc|data|const|mod):`~?([^`]+)`', r'\1', message)
+        
+        return message


 def versionadded(reason='', version='', line_length=70):
@@ -157,7 +163,8 @@ def versionadded(reason='', version='', line_length=70):

     :return: the decorated function.
     """
-    pass
+    adapter = SphinxAdapter('versionadded', reason=reason, version=version, line_length=line_length)
+    return adapter


 def versionchanged(reason='', version='', line_length=70):
@@ -180,7 +187,8 @@ def versionchanged(reason='', version='', line_length=70):

     :return: the decorated function.
     """
-    pass
+    adapter = SphinxAdapter('versionchanged', reason=reason, version=version, line_length=line_length)
+    return adapter


 def deprecated(reason='', version='', line_length=70, **kwargs):
@@ -218,4 +226,7 @@ def deprecated(reason='', version='', line_length=70, **kwargs):
     .. versionchanged:: 1.2.13
        Change the signature of the decorator to reflect the valid use cases.
     """
-    pass
+    action = kwargs.get('action')
+    category = kwargs.get('category', DeprecationWarning)
+    adapter = SphinxAdapter('deprecated', reason=reason, version=version, action=action, category=category, line_length=line_length)
+    return adapter