diff --git a/CHANGELOG.md b/CHANGELOG.md index dab3127..e6d5e9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## :package: [0.3.0](https://pypi.org/project/uk-election-ids/0.3.0/) - 2020-10-27 + +Added `senedd` election type + ## :package: [0.2.1](https://pypi.org/project/uk-election-ids/0.2.1/) - 2019-10-16 Tested on Python 3.8 diff --git a/setup.py b/setup.py index d7c0827..ce7b0fb 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def _get_description(): setup( name="uk_election_ids", - version="0.2.1", + version="0.3.0", author="chris48s", license="MIT", url="https://github.com/DemocracyClub/uk-election-ids/", diff --git a/tests/test_id_builder.py b/tests/test_id_builder.py index 4c2f3dd..d1f15ec 100644 --- a/tests/test_id_builder.py +++ b/tests/test_id_builder.py @@ -22,7 +22,7 @@ def test_string_date(self): self.assertEqual("parl.2018-05-03", election_id) def test_naw_sp_without_subtype(self): - for election_type in ("naw", "sp"): + for election_type in ("naw", "sp", "senedd"): id = IdBuilder(election_type, date(2018, 5, 3)).with_division( "test-division" ) @@ -37,12 +37,12 @@ def test_naw_sp_without_subtype(self): self.assertEqual(["%s.2018-05-03" % (election_type)], id.ids) def test_naw_sp_invalid_subtype(self): - for election_type in ("naw", "sp"): + for election_type in ("naw", "sp", "senedd"): with self.assertRaises(ValueError): IdBuilder(election_type, date(2018, 5, 3)).with_subtype("x") def test_naw_sp_valid_subtype_no_division(self): - for election_type in ("naw", "sp"): + for election_type in ("naw", "sp", "senedd"): id = IdBuilder(election_type, date(2018, 5, 3)).with_subtype("c") election_id = id.election_group_id self.assertEqual("%s.2018-05-03" % (election_type), election_id) @@ -61,12 +61,12 @@ def test_naw_sp_valid_subtype_no_division(self): ) def test_naw_sp_with_org(self): - for election_type in ("naw", "sp"): + for election_type in ("naw", "sp", "senedd"): with self.assertRaises(ValueError): IdBuilder(election_type, date(2018, 5, 3)).with_organisation("test-org") def test_naw_sp_with_division(self): - for election_type in ("naw", "sp"): + for election_type in ("naw", "sp", "senedd"): id = ( IdBuilder(election_type, date(2018, 5, 3)) .with_subtype("r") diff --git a/uk_election_ids/datapackage.py b/uk_election_ids/datapackage.py index 3a9f6d3..14fb1f3 100644 --- a/uk_election_ids/datapackage.py +++ b/uk_election_ids/datapackage.py @@ -30,6 +30,16 @@ "can_have_orgs": False, "can_have_divs": True, }, + "senedd": { + "name": "Senedd Cymru elections", + "subtypes": [ + {"name": "Constituencies", "election_subtype": "c"}, + {"name": "Regions", "election_subtype": "r"}, + ], + "default_voting_system": "AMS", + "can_have_orgs": False, + "can_have_divs": True, + }, "sp": { "name": "Scottish Parliament elections", "subtypes": [ diff --git a/uk_election_ids/election_ids.py b/uk_election_ids/election_ids.py index a495208..20094cd 100644 --- a/uk_election_ids/election_ids.py +++ b/uk_election_ids/election_ids.py @@ -79,7 +79,7 @@ def __init__(self, election_type, date): Args: election_type (str): May be one of - ``['europarl', 'gla', 'local', 'mayor', 'naw', 'nia', 'parl', 'pcc', 'sp']`` + ``['europarl', 'gla', 'local', 'mayor', 'naw', 'nia', 'parl', 'pcc', 'sp', 'senedd']`` date (date|str): May be either a python date object, or a string in 'Y-m-d' format. ``myid = IdBuilder('local', date(2018, 5, 3))`` and