diff --git a/tests/test_bipartite_matching.py b/tests/test_bipartite_matching.py index e4b25d51..057f7f9e 100644 --- a/tests/test_bipartite_matching.py +++ b/tests/test_bipartite_matching.py @@ -45,7 +45,7 @@ def test_empty(self): matching = maximum_bipartite_matching(adjacency, nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.nnz, 0) self.assertEqual(matching.shape, (degree, degree)) @@ -65,7 +65,7 @@ def test_complete_bipartite(self): matching = maximum_bipartite_matching(adjacency, nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, (degree, degree)) self.assert_is_unweighted_matching(matching) @@ -85,7 +85,7 @@ def test_simple(self): matching = maximum_bipartite_matching(adjacency, nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, (degree, degree)) self.assert_is_unweighted_matching(matching) @@ -103,7 +103,7 @@ def test_simple_2(self): matching = maximum_bipartite_matching(adjacency, nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, (6, 6)) self.assert_is_unweighted_matching(matching) @@ -121,7 +121,7 @@ def test_random(self): matching = maximum_bipartite_matching(adjacency, nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, adjacency.shape) self.assert_is_unweighted_matching(matching) @@ -132,7 +132,7 @@ def test_random_csr_matrix(self): matching = maximum_bipartite_matching(sp.csr_matrix(adjacency), nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, adjacency.shape) self.assert_is_unweighted_matching(matching) @@ -143,7 +143,7 @@ def test_random_csr_array(self): matching = maximum_bipartite_matching(sp.csr_array(adjacency), nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, adjacency.shape) self.assert_is_unweighted_matching(matching) @@ -154,7 +154,7 @@ def test_random_csc_array(self): matching = maximum_bipartite_matching(sp.csc_array(adjacency), nodes1, nodes2) - self.assertIsInstance(matching, sp.spmatrix) + self.assertTrue(sp.issparse(matching)) self.assertIsNot(matching, adjacency) self.assertEqual(matching.shape, adjacency.shape) self.assert_is_unweighted_matching(matching) diff --git a/tests/test_min_cost_flow.py b/tests/test_min_cost_flow.py index 91a2f560..e4df9f50 100644 --- a/tests/test_min_cost_flow.py +++ b/tests/test_min_cost_flow.py @@ -89,7 +89,7 @@ def test_scipy(self): [0.0, 0.0, 0.0, 0.0, 0.0, 2.0], ] ) - self.assertIsInstance(sol, sp.spmatrix) + self.assertTrue(sp.issparse(sol)) self.assertTrue(check_solution_scipy(sol, [candidate])) @unittest.skipIf(nx is None, "networkx is not installed")