"""Tests du collage des planches d'autocollants.""" from pathlib import Path from PIL import Image from lib.plots.sticker_sheets import plot_sticker_sheets def test_plot_sticker_sheets(tmp_path: Path) -> None: """Génère une grille de planches d'autocollants avec labels.""" stickers_path = tmp_path / "sticker_parts.csv" resources_dir = tmp_path / "figures" / "rebrickable" (resources_dir / "1000" / "stickers").mkdir(parents=True) (resources_dir / "2000" / "stickers").mkdir(parents=True) Image.new("RGB", (120, 80), color=(255, 0, 0)).save(resources_dir / "1000" / "stickers" / "st1.jpg") Image.new("RGB", (100, 60), color=(0, 255, 0)).save(resources_dir / "2000" / "stickers" / "st2.jpg") stickers_path.write_text( "set_num,set_id,year,name,part_num,part_name,quantity\n" "1000-1,1000,2020,Set A,st1,Sticker 1,1\n" "2000-1,2000,2021,Set B,st2,Sticker 2,1\n" ) destination = tmp_path / "figures" / "step35" / "sticker_sheets.png" plot_sticker_sheets(stickers_path, destination, resources_dir=resources_dir, columns=2) assert destination.exists() assert destination.stat().st_size > 0