diff --git a/outputs/political_axis_2025_Q1.html b/outputs/political_axis_2025_Q1.html new file mode 100644 index 0000000..a082342 --- /dev/null +++ b/outputs/political_axis_2025_Q1.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/outputs/political_axis_2025_Q2.html b/outputs/political_axis_2025_Q2.html new file mode 100644 index 0000000..4e62e9b --- /dev/null +++ b/outputs/political_axis_2025_Q2.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/outputs/political_axis_2025_Q3.html b/outputs/political_axis_2025_Q3.html new file mode 100644 index 0000000..682f724 --- /dev/null +++ b/outputs/political_axis_2025_Q3.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/outputs/political_axis_2025_Q4.html b/outputs/political_axis_2025_Q4.html new file mode 100644 index 0000000..b77c0a9 --- /dev/null +++ b/outputs/political_axis_2025_Q4.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/outputs/political_axis_2026_Q1.html b/outputs/political_axis_2026_Q1.html new file mode 100644 index 0000000..5a07829 --- /dev/null +++ b/outputs/political_axis_2026_Q1.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/outputs/trajectories_top15.html b/outputs/trajectories_top15.html new file mode 100644 index 0000000..1aacf5d --- /dev/null +++ b/outputs/trajectories_top15.html @@ -0,0 +1,7 @@ + + + +
+
+ + \ No newline at end of file diff --git a/tests/test_extract_mp_votes.py b/tests/test_extract_mp_votes.py index 1b0a503..ceda122 100644 --- a/tests/test_extract_mp_votes.py +++ b/tests/test_extract_mp_votes.py @@ -47,26 +47,29 @@ def test_extract_mp_votes(tmp_path): # Run extraction res = extract_mp_votes(db_path=str(db_file)) - # Expected MP rows: count keys that contain a comma in fixtures - expected_mp_count = 0 - for item in fixtures: - for k in item.get("voting_results", {}).keys(): - if "," in k: - expected_mp_count += 1 + # Expected rows: ALL actors (both individual MPs and party-level), across all motions + expected_total = sum(len(item.get("voting_results", {})) for item in fixtures) - assert res["mp_rows_inserted"] == expected_mp_count + assert res["mp_rows_inserted"] == expected_total assert res["motions_skipped"] == 0 - # Verify mp_votes table contains only rows with comma in mp_name and count matches + # Verify row count matches and both comma-name (individual) and no-comma (party) actors present conn = duckdb.connect(str(db_file)) try: - rows = conn.execute("SELECT mp_name FROM mp_votes").fetchall() + rows = conn.execute("SELECT mp_name, party FROM mp_votes").fetchall() finally: conn.close() - assert len(rows) == expected_mp_count - for (mp_name,) in rows: - assert "," in mp_name + assert len(rows) == expected_total + + # Individual MPs (comma in name) should have party = None (metadata not yet fetched) + # Party-level actors (no comma) should have party = mp_name + for mp_name, party in rows: + if "," not in mp_name: + # Party-level actor: party column should equal the actor name + assert party == mp_name, ( + f"Party actor '{mp_name}' should have party=mp_name, got {party!r}" + ) # Running again should be idempotent: no new mp rows, motions_skipped > 0 res2 = extract_mp_votes(db_path=str(db_file))