kopia lustrzana https://github.com/martinlackner/apportionment
black formatting
rodzic
d6ad9ef573
commit
b618119210
|
@ -43,7 +43,6 @@ jobs:
|
||||||
|
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
# note that some tests are skipped because Gurobi is not available on Github
|
|
||||||
coverage run --source=. -m pytest -v --tb=long -m unittests.py
|
coverage run --source=. -m pytest -v --tb=long -m unittests.py
|
||||||
|
|
||||||
- name: Generate coverage report
|
- name: Generate coverage report
|
||||||
|
|
|
@ -10,18 +10,11 @@ parties = 5
|
||||||
seats = 20
|
seats = 20
|
||||||
methods = ["quota", "largest_remainder", "dhondt", "saintelague", "adams"]
|
methods = ["quota", "largest_remainder", "dhondt", "saintelague", "adams"]
|
||||||
|
|
||||||
|
for iterations, votes in enumerate(combinations(range(1, maxvoters + 1), parties)):
|
||||||
iterator = combinations(range(1, maxvoters + 1), parties)
|
|
||||||
|
|
||||||
for iterations, votes in enumerate(iterator):
|
|
||||||
apportionments = set()
|
apportionments = set()
|
||||||
|
|
||||||
for method in methods:
|
for method in methods:
|
||||||
apportionments.add(
|
apportionments.add(tuple(app.compute(method, votes, seats, verbose=False)))
|
||||||
tuple(
|
|
||||||
app.compute(method, votes, seats, verbose=False)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(apportionments) == len(methods):
|
if len(apportionments) == len(methods):
|
||||||
break
|
break
|
||||||
|
@ -33,6 +26,4 @@ print("votes = {}".format(votes))
|
||||||
print("found in {} iterations\n\n".format(iterations))
|
print("found in {} iterations\n\n".format(iterations))
|
||||||
|
|
||||||
for method in methods:
|
for method in methods:
|
||||||
print(
|
print("{:>20s}: {}".format(method, app.compute(method, votes, seats, verbose=False)))
|
||||||
"{:>20s}: {}".format(method, app.compute(method, votes, seats, verbose=False))
|
|
||||||
)
|
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -100,4 +100,3 @@ setuptools.setup(
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue