27 lines
775 B
Python
27 lines
775 B
Python
"""Tests du graphique des minifigs par set."""
|
|
|
|
import matplotlib
|
|
from pathlib import Path
|
|
|
|
from lib.plots.minifig_counts import plot_minifigs_per_set
|
|
|
|
|
|
matplotlib.use("Agg")
|
|
|
|
|
|
def test_plot_minifigs_per_set_outputs_image(tmp_path: Path) -> None:
|
|
"""Génère l'image du nombre de minifigs par set."""
|
|
counts_path = tmp_path / "minifig_counts_by_set.csv"
|
|
destination_path = tmp_path / "figures" / "step20" / "minifigs_per_set.png"
|
|
counts_path.write_text(
|
|
"set_num,set_id,name,year,minifig_count\n"
|
|
"123-1,123,Set A,2020,2\n"
|
|
"124-1,124,Set B,2021,1\n"
|
|
"125-1,125,Set C,2021,0\n"
|
|
)
|
|
|
|
plot_minifigs_per_set(counts_path, destination_path)
|
|
|
|
assert destination_path.exists()
|
|
assert destination_path.stat().st_size > 0
|