diff --git a/graphs/tests/test_edmonds_blossom_algorithm.py b/graphs/tests/test_edmonds_blossom_algorithm.py index 39d49c3bd..6193a502c 100644 --- a/graphs/tests/test_edmonds_blossom_algorithm.py +++ b/graphs/tests/test_edmonds_blossom_algorithm.py @@ -4,9 +4,8 @@ from graphs.edmonds_blossom_algorithm import EdmondsBlossomAlgorithm class EdmondsBlossomAlgorithmTest(unittest.TestCase): - def convert_matching_to_array(self, matching): - """ Helper method to convert a + """Helper method to convert a list of matching pairs into a sorted 2D array. """ # Convert the list of pairs into a list of lists @@ -21,7 +20,7 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): return result def test_case_1(self): - """ Test Case 1: A triangle graph where vertices 0, 1, and 2 form a cycle. """ + """Test Case 1: A triangle graph where vertices 0, 1, and 2 form a cycle.""" edges = [[0, 1], [1, 2], [2, 0]] matching = EdmondsBlossomAlgorithm.maximum_matching(edges, 3) @@ -29,7 +28,7 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): assert expected == self.convert_matching_to_array(matching) def test_case_2(self): - """ Test Case 2: A disconnected graph with two components. """ + """Test Case 2: A disconnected graph with two components.""" edges = [[0, 1], [1, 2], [3, 4]] matching = EdmondsBlossomAlgorithm.maximum_matching(edges, 5) @@ -37,7 +36,7 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): assert expected == self.convert_matching_to_array(matching) def test_case_3(self): - """ Test Case 3: A cycle graph with an additional edge outside the cycle. """ + """Test Case 3: A cycle graph with an additional edge outside the cycle.""" edges = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5]] matching = EdmondsBlossomAlgorithm.maximum_matching(edges, 6) @@ -45,7 +44,7 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): assert expected == self.convert_matching_to_array(matching) def test_case_no_matching(self): - """ Test Case 4: A graph with no edges. """ + """Test Case 4: A graph with no edges.""" edges = [] # No edges matching = EdmondsBlossomAlgorithm.maximum_matching(edges, 3) @@ -53,7 +52,7 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): assert expected == self.convert_matching_to_array(matching) def test_case_large_graph(self): - """ Test Case 5: A complex graph with multiple cycles and extra edges. """ + """Test Case 5: A complex graph with multiple cycles and extra edges.""" edges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [1, 4], [2, 5]] matching = EdmondsBlossomAlgorithm.maximum_matching(edges, 6) @@ -69,5 +68,5 @@ class EdmondsBlossomAlgorithmTest(unittest.TestCase): assert result in (possible_matching_1, possible_matching_2) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()