def test_ignore_warning(self):
        """
        Emitted warnings from a function are ignored.
        """
        def func():
            """ Function to be decorated. """

        with warnings.catch_warnings(record=True) as warning:
            warnings.simplefilter('always')
            ignore_warning(DeprecationWarning)(func)()
            deprecated('Yep!')(func)()
            assert len(warning) == 0
    def test_deprecated(self):
        """
        Calling a deprecated function emits a warning.
        """
        def func():
            """ Function to be decorated. """

        with warnings.catch_warnings(record=True) as warning:
            warnings.simplefilter('always')
            deprecated('Yep!')(func)()
            assert len(warning) == 1
            assert issubclass(warning[0].category, DeprecationWarning)
            assert str(warning[0].message
                       ) == 'You called the deprecated function `func`. Yep!'