def test_hook_with_extension(template, output_dir) -> None:
    """Verify custom Jinja2 extension correctly work in hooks and file rendering.

    Each file in hooks has simple tests inside and will raise error if not
    correctly rendered.
    """
    project_dir = main.cookiecutter(
        template,
        no_input=True,
        output_dir=output_dir,
        extra_context={'project_slug': 'foobar', 'name': 'Cookiemonster'},
    )

    readme = Path(project_dir, 'README.rst').read_text(encoding="utf-8")
    assert readme.strip() == 'Hello Cookiemonster!'
Verify custom Jinja2 extension correctly work in hooks and file rendering.

    Each file in hooks has simple tests inside and will raise error if not
    correctly rendered.
    
tests/test_custom_extensions_in_hooks.py