From b52f8a19e6a02fcab741bee5abd452d85906df16 Mon Sep 17 00:00:00 2001 From: benjaminkrenn Date: Mon, 13 Jan 2020 12:23:12 +0100 Subject: [PATCH] add test for modified saintelague --- unittests.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/unittests.py b/unittests.py index c753616..bfc81b6 100644 --- a/unittests.py +++ b/unittests.py @@ -73,6 +73,7 @@ class TestApprovalMultiwinner(unittest.TestCase): "largest_remainder": [51, 44, 2, 2, 1], "dhondt": [52, 45, 1, 1, 1], "saintelague": [51, 43, 2, 2, 2], + "modified_saintelague": [51, 43, 2, 2, 2], "huntington": [51, 43, 2, 2, 2], "adams": [51, 43, 2, 2, 2], "dean": [51, 43, 2, 2, 2] @@ -133,6 +134,15 @@ class TestApprovalMultiwinner(unittest.TestCase): self.assertNotEqual(unfiltered_result, filtered_result, "Result did not change despite threshold") - + def test_saintelague_difference(self): + votes = [6, 1] + seats = 4 + r1 = apportionment.method("saintelague", votes, + seats, verbose=False) # [4, 0] + r2 = apportionment.method("modified_saintelague", votes, + seats, verbose=False) # [3, 1] + self.assertNotEqual(r1, r2, + "Saintelague should produce different "+ + "result than modified variant.") if __name__ == '__main__': unittest.main()