1

Filtre les pièces techniques et documente l’étape 28

This commit is contained in:
2025-12-02 15:28:22 +01:00
parent 301e2e25c5
commit a93813a9f7
12 changed files with 109 additions and 13 deletions

View File

@@ -33,6 +33,7 @@ def test_plot_colors_grid(tmp_path: Path) -> None:
"""Produit un fichier image avec les couleurs utilisées."""
parts_path = tmp_path / "parts_filtered.csv"
colors_path = tmp_path / "colors.csv"
parts_catalog_path = tmp_path / "parts.csv"
destination_path = tmp_path / "colors_grid.png"
write_csv(
@@ -45,6 +46,16 @@ def test_plot_colors_grid(tmp_path: Path) -> None:
["3004", "0033B2", "false", "1000", "10", "false"],
],
)
write_csv(
parts_catalog_path,
["part_num", "name", "part_cat_id"],
[
["3001", "Brick", "11"],
["3002", "Pane", "23"],
["3003", "Slope", "3"],
["3004", "Technic", "8"],
],
)
write_csv(
colors_path,
["id", "name", "rgb", "is_trans", "num_parts", "num_sets", "y1", "y2"],
@@ -52,13 +63,14 @@ def test_plot_colors_grid(tmp_path: Path) -> None:
["1", "White", "FFFFFF", "False", "0", "0", "0", "0"],
["2", "Black", "000000", "True", "0", "0", "0", "0"],
["3", "Red", "FF0000", "False", "0", "0", "0", "0"],
["4", "Ignored Blue", "0033B2", "False", "0", "0", "0", "0"],
],
)
colors = load_used_colors(parts_path, colors_path)
assert len(colors) == 3
colors = load_used_colors(parts_path, colors_path, parts_catalog_path)
assert len(colors) == 2
plot_colors_grid(parts_path, colors_path, destination_path)
plot_colors_grid(parts_path, colors_path, parts_catalog_path, destination_path)
assert destination_path.exists()
assert destination_path.stat().st_size > 0