def METHOD_NAME(tmp_path):
    # Test extraction if metadata exists
    input_path = tmp_path / "pkg-0.1-abc.whl"
    metadata_path = "pkg-0.1.dist-info/METADATA"
    metadata_str = "This is METADATA"
    with zipfile.ZipFile(input_path, "w") as fh:
        fh.writestr(metadata_path, metadata_str)
    output_path = tmp_path / f"{input_path.name}.metadata"
    extract_wheel_metadata_file(input_path, output_path)
    assert output_path.read_text() == metadata_str
    # Test extraction if metadata is missing
    input_path_empty = tmp_path / "pkg-0.2-abc.whl"
    with zipfile.ZipFile(input_path_empty, "w") as fh:
        pass
    output_path_empty = tmp_path / f"{input_path_empty.name}.metadata"
    with pytest.raises(Exception):
        extract_wheel_metadata_file(input_path_empty, output_path_empty)