From 21be2899d53c4ecfc527db5de28b27bb14e0641b Mon Sep 17 00:00:00 2001 From: Anna Bruce <44057980+the-Bruce@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:08:36 +0000 Subject: [PATCH] black isort --- votes/stv.py | 10 ++++++---- votes/tests/test_stv.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/votes/stv.py b/votes/stv.py index fff048f..e3874a8 100644 --- a/votes/stv.py +++ b/votes/stv.py @@ -256,7 +256,9 @@ def full_election(self): pass def winners(self): - return list(map( - attrgetter("id"), - filter(lambda x: x.status == States.ELECTED, self.candidates), - )) + return list( + map( + attrgetter("id"), + filter(lambda x: x.status == States.ELECTED, self.candidates), + ) + ) diff --git a/votes/tests/test_stv.py b/votes/tests/test_stv.py index a87608d..3633ceb 100644 --- a/votes/tests/test_stv.py +++ b/votes/tests/test_stv.py @@ -59,19 +59,19 @@ def test_two_available_three(): def test_corner_case(): c = {1, 2, 3, 4, 5, 6, 7, 8} v = ( - [(1, 2, 3, 4, 5, 6, 7, 8)] + - [(3, 4, 5, 6, 7, 8, 1, 2)] * 36 + - [(4, 5, 6, 7, 8, 1, 2, 3)] * 6 + - [(5, 6, 7, 8, 1, 2, 3, 4)] * 13 + - [(6, 7, 8, 1, 2, 3, 4, 5)] * 4 + - [(7, 8, 1, 2, 3, 4, 5, 6)] * 2 + - [(8, 1, 2, 3, 4, 5, 6, 7)] * 4 + [(1, 2, 3, 4, 5, 6, 7, 8)] + + [(3, 4, 5, 6, 7, 8, 1, 2)] * 36 + + [(4, 5, 6, 7, 8, 1, 2, 3)] * 6 + + [(5, 6, 7, 8, 1, 2, 3, 4)] * 13 + + [(6, 7, 8, 1, 2, 3, 4, 5)] * 4 + + [(7, 8, 1, 2, 3, 4, 5, 6)] * 2 + + [(8, 1, 2, 3, 4, 5, 6, 7)] * 4 ) e = Election(c, v, 2) e.full_election() # Bug caused the second round to erroneously tiebreak between all people after electing 3. # Check this isn't reintroduced - assert e.actlog[2]['type'] != "tiebreak" + assert e.actlog[2]["type"] != "tiebreak" assert sorted(e.winners()) == [3, 5]