1

Chiffre les personnages par année avec heatmap

This commit is contained in:
2025-12-02 02:02:47 +01:00
parent dbfa46a99f
commit 6de5e8c585
8 changed files with 27 additions and 20 deletions

View File

@@ -39,7 +39,7 @@ def test_write_character_counts_outputs_csv(tmp_path: Path) -> None:
def test_aggregate_presence_by_year_excludes_figurants(tmp_path: Path) -> None:
"""Calcule la présence annuelle en excluant les figurants."""
"""Calcule le total annuel en excluant les figurants."""
sets_path = tmp_path / "sets_enriched.csv"
sets_path.write_text(
"set_num,year\n"
@@ -55,6 +55,6 @@ def test_aggregate_presence_by_year_excludes_figurants(tmp_path: Path) -> None:
presence = aggregate_presence_by_year(minifigs_rows, sets_years, excluded_characters=["Figurant"])
assert presence == [
{"known_character": "Owen Grady", "year": "2020", "present": "1"},
{"known_character": "Owen Grady", "year": "2021", "present": "0"},
{"known_character": "Owen Grady", "year": "2020", "minifig_count": "1"},
{"known_character": "Owen Grady", "year": "2021", "minifig_count": "0"},
]

View File

@@ -14,10 +14,10 @@ def test_plot_character_year_presence(tmp_path: Path) -> None:
presence_path = tmp_path / "minifig_characters_year_presence.csv"
destination = tmp_path / "figures" / "step22" / "minifig_characters_timeline.png"
presence_path.write_text(
"known_character,year,present\n"
"Owen Grady,2020,1\n"
"known_character,year,minifig_count\n"
"Owen Grady,2020,2\n"
"Owen Grady,2021,0\n"
"Figurant,2020,1\n"
"Figurant,2020,3\n"
)
plot_character_year_presence(presence_path, destination)