def test_generate_files_permissions(tmp_path) -> None:
    """Verify generates files respect source files permissions.

    simple.txt and script.sh should retain their respective 0o644 and 0o755
    permissions.
    """
    generate.generate_files(
        context={'cookiecutter': {'permissions': 'permissions'}},
        repo_dir='tests/test-generate-files-permissions',
        output_dir=tmp_path,
    )

    assert Path(tmp_path, 'inputpermissions/simple.txt').is_file()

    # Verify source simple.txt should still be 0o644
    tests_simple_file = Path(
        'tests',
        'test-generate-files-permissions',
        'input{{cookiecutter.permissions}}',
        'simple.txt',
    )
    tests_simple_file_mode = tests_simple_file.stat().st_mode

    input_simple_file = Path(tmp_path, 'inputpermissions', 'simple.txt')
    input_simple_file_mode = input_simple_file.stat().st_mode
    assert tests_simple_file_mode == input_simple_file_mode

    assert Path(tmp_path, 'inputpermissions/script.sh').exists()
    assert Path(tmp_path, 'inputpermissions/script.sh').is_file()

    # Verify source script.sh should still be 0o755
    tests_script_file = Path(
        'tests',
        'test-generate-files-permissions',
        'input{{cookiecutter.permissions}}',
        'script.sh',
    )
    tests_script_file_mode = tests_script_file.stat().st_mode

    input_script_file = Path(tmp_path, 'inputpermissions', 'script.sh')
    input_script_file_mode = input_script_file.stat().st_mode
    assert tests_script_file_mode == input_script_file_mode
Verify generates files respect source files permissions.

    simple.txt and script.sh should retain their respective 0o644 and 0o755
    permissions.
    
tests/test_generate_files.py