Skip to content

Commit ff0088f

Browse files
committed
removes 'gemeente' from default output file name for GR elections
1 parent d2ef8d5 commit ff0088f

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/eml2csv/lib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,10 @@ def eml2csv(counts_eml_path: str, candidates_eml_path: str, output_csv_path: str
286286
election_id = normalise(
287287
_get_mandatory_attrib(counts_eml.find(".//eml:ElectionIdentifier", namespaces=NS), "Id")
288288
)[:6]
289-
output_csv_path = (
290-
f"osv4-3_telling_{election_id}_{authority_type.lower().replace(' ', '_')}_{normalise(authority_name)}.csv"
291-
)
289+
if election_id.lower().startswith("gr"):
290+
output_csv_path = f"osv4-3_telling_{election_id}_{normalise(authority_name)}.csv"
291+
else:
292+
output_csv_path = f"osv4-3_telling_{election_id}_{authority_type.lower().replace(' ', '_')}_{normalise(authority_name)}.csv"
292293

293294
output.write_to_file(output_csv_path)
294295

File renamed without changes.

tests/test_eml2csv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_tk25_output_csv_matches_oracle_file(tmp_path):
2222

2323

2424
def test_gr22_output_csv_matches_oracle_file(tmp_path):
25-
output_csv = "osv4-3_telling_gr2022_gemeente_westmaasenwaal.csv"
25+
output_csv = "osv4-3_telling_gr2022_westmaasenwaal.csv"
2626
eml2csv(
2727
counts_eml_path="tests/Telling_GR2022_WestMaasenWaal.eml.xml",
2828
candidates_eml_path="tests/Kandidatenlijsten_GR2022_WestMaasenWaal.eml.xml",
@@ -53,7 +53,7 @@ def change_to_tmp_path(tmp_path):
5353
"Kandidatenlijsten_TK2025_Nijmegen.eml.xml",
5454
),
5555
(
56-
"osv4-3_telling_gr2022_gemeente_westmaasenwaal.csv",
56+
"osv4-3_telling_gr2022_westmaasenwaal.csv",
5757
"Telling_GR2022_WestMaasenWaal.eml.xml",
5858
"Kandidatenlijsten_GR2022_WestMaasenWaal.eml.xml",
5959
),

0 commit comments

Comments
 (0)