Implement census analysis: read, count, summarise, write and CLI

Closes #11
Closes #12
Closes #13
Closes #14
Closes #15

Task: MIL-002#4
Task: MIL-002#5
Task: MIL-002#6
Task: MIL-002#7
Task: MIL-002#8
This commit is contained in:
2026-10-13 15:37:51 +08:00
parent 259d017ad2
commit 7459711243
9 changed files with 364 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
"""Check the counts of the real 2018 Central Park census file, when present."""
import pathlib
import pytest
from squirrel import census
from squirrel.constants import DEFAULT_INPUT_PATH, FUR_COLORS
REPO_ROOT = pathlib.Path(__file__).parents[1]
def test_real_census_counts_match_published_figures() -> None:
path = REPO_ROOT / DEFAULT_INPUT_PATH
if not path.is_file():
pytest.skip(f"census file not present: {path}")
counts = census.count_by_fur_color(census.read_csv(path))
gray, cinnamon, black = FUR_COLORS
assert counts == {gray: 2473, cinnamon: 392, black: 103}