Skip to content

Commit

Permalink
Merge pull request #4 from DemocracyClub/allow-ref
Browse files Browse the repository at this point in the history
Add referendum to ELECTION_TYPES
  • Loading branch information
michaeljcollinsuk committed Sep 13, 2021
2 parents 53e30d7 + 7cccc2e commit c579830
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions tests/test_id_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,6 @@ def test_eq_different_types(self):
obj2 = 7
self.assertNotEqual(obj1, obj2)

def test_ref(self):
with self.assertRaises(NotImplementedError):
IdBuilder("ref", date(2018, 5, 3))

def test_none(self):
id = (
IdBuilder("local", date(2018, 5, 3))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_valid_ids(self):
self.assertTrue(validate("gla.c.barnet-and-camden.by.2016-05-05"))
self.assertTrue(validate("europarl.2014-05-22"))
self.assertTrue(validate("europarl.uk-wales.2014-05-22"))
self.assertTrue(validate("ref.croydon.2021-10-07"))

def test_invalid_ids(self):
self.assertFalse(validate(7)) # not string
Expand All @@ -54,7 +55,6 @@ def test_invalid_ids(self):
validate("gla.r.barnet-and-camden.2016-05-05")
) # invalid subtype
self.assertFalse(validate("naw.x.2019-01-01")) # invalid subtype
self.assertFalse(validate("ref.2019-01-01")) # not implemented
# too many clauses
self.assertFalse(validate("naw.r.mid-and-west-wales.something-else.2016-05-05"))
self.assertFalse(validate("sp.c.shetland-islands.something-else.2019-08-29"))
Expand Down
7 changes: 7 additions & 0 deletions uk_election_ids/datapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@
"can_have_orgs": True,
"can_have_divs": False,
},
"ref": {
"name": "Referendum elections",
"subtypes": [],
"default_voting_system": "FPTP",
"can_have_orgs": True,
"can_have_divs": True,
},
}
2 changes: 0 additions & 2 deletions uk_election_ids/election_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ def __init__(self, election_type, date):
Returns:
IdBuilder
"""
if election_type == "ref":
raise NotImplementedError()
self._validate_election_type(election_type)
self.election_type = election_type
self.spec = RULES[self.election_type]
Expand Down

0 comments on commit c579830

Please sign in to comment.