def test_decorators_argument_converters_consistency(
    moviepy_modules, functions_with_decorator_defined, decorator_name
):
    """Checks that for all functions that have a decorator defined (like
    ``@convert_parameter_to_seconds``), the parameters passed to the decorator
    correspond to the parameters taken by the function.

    This test is util to prevent next case in which the parameter names doesn't
    match between the decorator and the function definition:

    >>> @convert_parameter_to_seconds(['foo'])
    >>> def whatever_function(bar):  # bar not converted to seconds
    ...     pass

    Some wrong definitions remained unnoticed in the past before this test was
    added.
    """
    with contextlib.redirect_stdout(io.StringIO()):
        for modname, ispkg in moviepy_modules():
            if ispkg:
                continue

            try:
                module = importlib.import_module(modname)
            except ImportError:
                continue

            functions_with_decorator = functions_with_decorator_defined(
                module,
                decorator_name,
            )

            for function_data in functions_with_decorator:
                for argument_name in function_data["decorator_arguments"]:
                    funcname = function_data["function_name"]
                    assert argument_name in function_data["function_arguments"], (
                        f"Wrong argument name '{argument_name}' in"
                        f" '@{decorator_name}' decorator for function"
                        f" '{funcname}' found inside module '{modname}'"
                    )

                assert function_data["decorator_arguments"]
                assert function_data["function_arguments"]
Checks that for all functions that have a decorator defined (like
    ``@convert_parameter_to_seconds``), the parameters passed to the decorator
    correspond to the parameters taken by the function.

    This test is util to prevent next case in which the parameter names doesn't
    match between the decorator and the function definition:

    >>> @convert_parameter_to_seconds(['foo'])
    >>> def whatever_function(bar):  # bar not converted to seconds
    ...     pass

    Some wrong definitions remained unnoticed in the past before this test was
    added.
    
tests/test_tools.py