"""Tests du diagramme de répartition des genres."""

import matplotlib
from pathlib import Path

from lib.plots.minifig_gender_share import plot_minifig_gender_share


matplotlib.use("Agg")


def test_plot_minifig_gender_share(tmp_path: Path) -> None:
    """Génère le graphique de répartition par genre."""
    counts_path = tmp_path / "gender_counts.csv"
    destination = tmp_path / "figures" / "step25" / "minifig_gender_share.png"
    counts_path.write_text(
        "gender,minifig_count\n"
        "male,2\n"
        "female,1\n"
        "unknown,1\n"
    )

    plot_minifig_gender_share(counts_path, destination)

    assert destination.exists()
    assert destination.stat().st_size > 0
