1
etude_lego_jurassic_world/tests/test_rare_parts_plot.py

26 lines
887 B
Python

"""Tests du graphique des pièces rares par set."""
import matplotlib
from pathlib import Path
from lib.plots.rare_parts import plot_rare_parts_per_set
matplotlib.use("Agg")
def test_plot_rare_parts_per_set_outputs_image(tmp_path: Path) -> None:
"""Génère l'image du top des sets avec pièces exclusives."""
rare_by_set_path = tmp_path / "rare_parts_by_set.csv"
destination_path = tmp_path / "figures" / "step27" / "rare_parts_per_set.png"
rare_by_set_path.write_text(
"set_num,set_id,name,year,in_collection,rare_parts_distinct,rare_parts_quantity,rare_minifig_parts_distinct,rare_minifig_quantity\n"
"1000-1,1000,Set A,2020,true,3,5,1,2\n"
"2000-1,2000,Set B,2021,false,2,4,0,0\n"
)
plot_rare_parts_per_set(rare_by_set_path, destination_path)
assert destination_path.exists()
assert destination_path.stat().st_size > 0