forked from pool/python-munkres
Accepting request 834359 from home:pgajdos:python
- do not depend on deprecated nose - added patches fix https://github.com/bmc/munkres/pull/32 + python-munkres-remove-nose.patch OBS-URL: https://build.opensuse.org/request/show/834359 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-munkres?expand=0&rev=9
This commit is contained in:
parent
f2bd20f6d5
commit
116c03b45c
90
python-munkres-remove-nose.patch
Normal file
90
python-munkres-remove-nose.patch
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
--- munkres-release-1.1.2/test/test_munkres.py.orig 2020-09-14 19:17:32.667531075 +0000
|
||||||
|
+++ munkres-release-1.1.2/test/test_munkres.py 2020-09-14 19:24:53.882111837 +0000
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
from munkres import Munkres, DISALLOWED, UnsolvableMatrix
|
||||||
|
import munkres
|
||||||
|
-from nose.tools import assert_equals, raises
|
||||||
|
+import pytest
|
||||||
|
|
||||||
|
m = Munkres()
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ def test_documented_example():
|
||||||
|
[10, 3, 2],
|
||||||
|
[8, 7, 4]]
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 12)
|
||||||
|
+ assert cost == 12
|
||||||
|
|
||||||
|
def test_5_x_5():
|
||||||
|
matrix = [[12, 9, 27, 10, 23],
|
||||||
|
@@ -25,7 +25,7 @@ def test_5_x_5():
|
||||||
|
[9, 28, 26, 23, 13],
|
||||||
|
[16, 16, 24, 6, 9]]
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 51)
|
||||||
|
+ assert cost == 51
|
||||||
|
|
||||||
|
def test_10_x_10():
|
||||||
|
matrix = [[37, 34, 29, 26, 19, 8, 9, 23, 19, 29],
|
||||||
|
@@ -39,7 +39,7 @@ def test_10_x_10():
|
||||||
|
[21, 25, 23, 39, 31, 37, 32, 33, 38, 1],
|
||||||
|
[17, 34, 40, 10, 29, 37, 40, 3, 25, 3]]
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 66)
|
||||||
|
+ assert cost == 66
|
||||||
|
|
||||||
|
def test_20_x_20():
|
||||||
|
matrix = [[5, 4, 3, 9, 8, 9, 3, 5, 6, 9, 4, 10, 3, 5, 6, 6, 1, 8, 10, 2],
|
||||||
|
@@ -63,14 +63,14 @@ def test_20_x_20():
|
||||||
|
[9, 6, 3, 1, 8, 5, 7, 8, 7, 2, 1, 8, 2, 8, 3, 7, 4, 8, 7, 7],
|
||||||
|
[8, 4, 4, 9, 7, 10, 6, 2, 1, 5, 8, 5, 1, 1, 1, 9, 1, 3, 5, 3]]
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 22)
|
||||||
|
+ assert cost == 22
|
||||||
|
|
||||||
|
def test_disallowed():
|
||||||
|
matrix = [[5, 9, DISALLOWED],
|
||||||
|
[10, DISALLOWED, 2],
|
||||||
|
[8, DISALLOWED, 4]]
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 19)
|
||||||
|
+ assert cost == 19
|
||||||
|
|
||||||
|
def test_profit():
|
||||||
|
profit_matrix = [[94, 66, 100, 18, 48],
|
||||||
|
@@ -84,7 +84,7 @@ def test_profit():
|
||||||
|
)
|
||||||
|
indices = m.compute(cost_matrix)
|
||||||
|
profit = sum([profit_matrix[row][column] for row, column in indices])
|
||||||
|
- assert_equals(profit, 392)
|
||||||
|
+ assert profit == 392
|
||||||
|
|
||||||
|
def test_irregular():
|
||||||
|
matrix = [[12, 26, 17],
|
||||||
|
@@ -94,7 +94,7 @@ def test_irregular():
|
||||||
|
[15, 93, 55, 80]]
|
||||||
|
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(cost, 43)
|
||||||
|
+ assert cost == 43
|
||||||
|
|
||||||
|
def test_rectangular():
|
||||||
|
matrix = [[34, 26, 17, 12],
|
||||||
|
@@ -106,13 +106,13 @@ def test_rectangular():
|
||||||
|
padded_matrix = m.pad_matrix(matrix, 0)
|
||||||
|
padded_cost = _get_cost(padded_matrix)
|
||||||
|
cost = _get_cost(matrix)
|
||||||
|
- assert_equals(padded_cost, cost)
|
||||||
|
- assert_equals(cost, 70)
|
||||||
|
+ assert padded_cost == cost
|
||||||
|
+ assert cost == 70
|
||||||
|
|
||||||
|
-@raises(UnsolvableMatrix)
|
||||||
|
def test_unsolvable():
|
||||||
|
matrix = [[5, 9, DISALLOWED],
|
||||||
|
[10, DISALLOWED, 2],
|
||||||
|
[DISALLOWED, DISALLOWED, DISALLOWED]]
|
||||||
|
- m.compute(matrix)
|
||||||
|
+ with pytest.raises(UnsolvableMatrix):
|
||||||
|
+ m.compute(matrix)
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 14 19:32:25 UTC 2020 - pgajdos@suse.com
|
||||||
|
|
||||||
|
- do not depend on deprecated nose
|
||||||
|
- added patches
|
||||||
|
fix https://github.com/bmc/munkres/pull/32
|
||||||
|
+ python-munkres-remove-nose.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Apr 1 08:57:28 UTC 2019 - pgajdos@suse.com
|
Mon Apr 1 08:57:28 UTC 2019 - pgajdos@suse.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-munkres
|
# spec file for package python-munkres
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2020 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -26,9 +26,11 @@ License: Apache-2.0
|
|||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: http://software.clapper.org/munkres/
|
URL: http://software.clapper.org/munkres/
|
||||||
Source: https://github.com/bmc/munkres/archive/release-%{version}.tar.gz
|
Source: https://github.com/bmc/munkres/archive/release-%{version}.tar.gz
|
||||||
|
# https://github.com/bmc/munkres/pull/32
|
||||||
|
Patch0: python-munkres-remove-nose.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
# SECTION test requirements
|
# SECTION test requirements
|
||||||
BuildRequires: %{python_module nose}
|
BuildRequires: %{python_module pytest}
|
||||||
# /SECTION
|
# /SECTION
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -48,6 +50,7 @@ http://csclab.murraystate.edu/~bob.pilgrim/445/munkres.html.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n munkres-release-%{version}
|
%setup -q -n munkres-release-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@ -62,7 +65,7 @@ chmod -x %{buildroot}%{$python_sitelib}/munkres.py
|
|||||||
}
|
}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%python_expand nosetests-%{$python_bin_suffix}
|
%pytest
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE.md
|
%license LICENSE.md
|
||||||
|
Loading…
x
Reference in New Issue
Block a user