1

Ajoute les visualisations des couleurs de têtes de minifigs et jalons

This commit is contained in:
2025-12-01 23:41:32 +01:00
parent 7fe02ea263
commit d7b4ad8031
9 changed files with 521 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
"""Tests des visualisations des couleurs de têtes de minifigs."""
import matplotlib
from pathlib import Path
from lib.plots.minifig_heads import plot_global_shares, plot_shares_by_year
matplotlib.use("Agg")
def test_plot_minifig_heads(tmp_path: Path) -> None:
"""Produit les graphes part par année et global."""
heads_path = tmp_path / "minifig_heads_by_year.csv"
milestones_path = tmp_path / "milestones.csv"
shares_dest = tmp_path / "figures" / "step16" / "minifig_heads_shares.png"
global_dest = tmp_path / "figures" / "step16" / "minifig_heads_global.png"
heads_path.write_text(
"year,color_rgb,is_translucent,color_name,quantity\n"
"2020,FFE1BD,false,Light Flesh,2\n"
"2020,FFFF00,false,Yellow,1\n"
"2021,FFE1BD,false,Light Flesh,1\n"
"2021,E7B68F,false,Medium Dark Flesh,3\n"
)
milestones_path.write_text("year,description\n2020,Jalon Test\n")
plot_shares_by_year(heads_path, shares_dest, milestones_path=milestones_path)
plot_global_shares(heads_path, global_dest)
assert shares_dest.exists()
assert shares_dest.stat().st_size > 0
assert global_dest.exists()
assert global_dest.stat().st_size > 0