| 1 |
From: Stefano Rivera <[email protected]> |
| 2 |
Date: Sat, 17 Oct 2020 11:15:04 -0700 |
| 3 |
Subject: Use a constant cost calculation in test_profit_float() |
| 4 |
|
| 5 |
Rather than an architecture-specific calculation, when our variable |
| 6 |
precision does not differ across architectures. |
| 7 |
|
| 8 |
Bug-Upstream: https://github.com/bmc/munkres/issues/40 |
| 9 |
Forwarded: https://github.com/bmc/munkres/pull/41 |
| 10 |
--- |
| 11 |
test/test_munkres.py | 6 +++--- |
| 12 |
1 file changed, 3 insertions(+), 3 deletions(-) |
| 13 |
|
| 14 |
diff --git a/test/test_munkres.py b/test/test_munkres.py |
| 15 |
index b3b776e..1bbd95b 100644 |
| 16 |
--- a/test/test_munkres.py |
| 17 |
+++ b/test/test_munkres.py |
| 18 |
@@ -162,13 +162,13 @@ def test_profit_float(): |
| 19 |
[37.11, 53.12, 57.13, 78.14, 28.15], |
| 20 |
[59.16, 43.17, 97.18, 88.19, 48.2], |
| 21 |
[52.21, 19.22, 89.23, 60.24, 60.25]] |
| 22 |
- import sys |
| 23 |
+ max_ = 2**32 |
| 24 |
cost_matrix = munkres.make_cost_matrix( |
| 25 |
- profit_matrix, lambda cost: sys.maxsize - cost |
| 26 |
+ profit_matrix, lambda cost: max_ - cost |
| 27 |
) |
| 28 |
indices = m.compute(cost_matrix) |
| 29 |
profit = sum([profit_matrix[row][column] for row, column in indices]) |
| 30 |
- assert profit == pytest.approx(362.65) |
| 31 |
+ assert profit == pytest.approx(392.65) |
| 32 |
|
| 33 |
def test_irregular(): |
| 34 |
matrix = [[12, 26, 17], |