diff --git a/algorithms/graph/bipartile/max_bipartile_matching.py b/algorithms/graph/bipartile/max_bipartile_matching.py index c138afd..a7cff2d 100644 --- a/algorithms/graph/bipartile/max_bipartile_matching.py +++ b/algorithms/graph/bipartile/max_bipartile_matching.py @@ -125,7 +125,7 @@ def test_graph_with_multiple_matchings(self): expected1 = {"U1": "V1", "U2": "V2", "U3": "V3"} expected2 = {"U1": "V2", "U2": "V1", "U3": "V3"} result = max_bipartite_matching(graph) - self.assertIn(result, [expected1, expected2]) + self.assertTrue(result in [expected1, expected2]) if __name__ == "__main__": diff --git a/algorithms/graph/cyclic/shortest_weighted_cycle.py b/algorithms/graph/cyclic/shortest_weighted_cycle.py index 858d139..ebb52c8 100644 --- a/algorithms/graph/cyclic/shortest_weighted_cycle.py +++ b/algorithms/graph/cyclic/shortest_weighted_cycle.py @@ -99,8 +99,8 @@ def test_remove_edge(self): def test_add_edge(self): self.g.add_edge(2, 5, 4) - self.assertIn((5, 4), self.g.adj[2]) - self.assertIn((2, 4), self.g.adj[5]) + self.assertTrue((5, 4) in self.g.adj[2]) + self.assertTrue((2, 4) in self.g.adj[5]) if __name__ == "__main__": diff --git a/algorithms/graph/graph_representation/basic_graph.py b/algorithms/graph/graph_representation/basic_graph.py index e10896f..899f55e 100644 --- a/algorithms/graph/graph_representation/basic_graph.py +++ b/algorithms/graph/graph_representation/basic_graph.py @@ -160,7 +160,7 @@ def test_neighbors(self): def test_add_vertex(self): self.graph.add_vertex("C") - self.assertIn("C", self.graph.vertices) + self.assertTrue("C" in self.graph.vertices) def test_remove_vertex(self): self.graph.remove_vertex("B") diff --git a/algorithms/graph/graph_representation/oo.py b/algorithms/graph/graph_representation/oo.py index 4a5fd21..ac5900d 100644 --- a/algorithms/graph/graph_representation/oo.py +++ b/algorithms/graph/graph_representation/oo.py @@ -29,8 +29,8 @@ def test_add_vertex(self): g.add_vertex(a) g.add_vertex(b) self.assertEqual(len(g.graph_dict), 2) - self.assertIn("A", g.graph_dict) - self.assertIn("B", g.graph_dict) + self.assertTrue("A" in g.graph_dict) + self.assertTrue("B" in g.graph_dict) def test_add_edge(self): g = Graph() @@ -39,7 +39,7 @@ def test_add_edge(self): g.add_vertex(a) g.add_vertex(b) g.add_edge("A", "B", 1) - self.assertIn("B", g.graph_dict["A"].edges) + self.assertTrue("B" in g.graph_dict["A"].edges) self.assertEqual(g.graph_dict["A"].edges["B"], 1) diff --git a/algorithms/searching/interpolation_search.py b/algorithms/searching/interpolation_search.py index d5aaa2a..9adce7e 100644 --- a/algorithms/searching/interpolation_search.py +++ b/algorithms/searching/interpolation_search.py @@ -38,7 +38,7 @@ def test_duplicate_elements(self): arr = [1, 2, 3, 4, 4, 5, 6] x = 4 result = interpolation_search(arr, x) - self.assertIn(result, [3, 4], "Incorrect result with duplicate elements") + self.assertTrue(result in [3, 4], "Incorrect result with duplicate elements") if __name__ == "__main__": diff --git a/algorithms/searching/linear_search.py b/algorithms/searching/linear_search.py index 5791b03..37fcbf1 100644 --- a/algorithms/searching/linear_search.py +++ b/algorithms/searching/linear_search.py @@ -31,7 +31,7 @@ def test_duplicate_elements(self): arr = [1, 2, 3, 4, 4, 5, 6] x = 4 result = linear_search(arr, x) - self.assertIn(result, [3, 4], "Incorrect result with duplicate elements") + self.assertTrue(result in [3, 4], "Incorrect result with duplicate elements") if __name__ == "__main__": diff --git a/data_structures/graphs/graph.py b/data_structures/graphs/graph.py index 2677c5d..735774d 100644 --- a/data_structures/graphs/graph.py +++ b/data_structures/graphs/graph.py @@ -38,11 +38,11 @@ def setUp(self): def test_add_vertex(self): self.graph.add_vertex(4) - self.assertIn(4, self.graph.get_vertices()) + self.assertTrue(4 in self.graph.get_vertices()) def test_add_edge(self): self.graph.add_edge(3, 1) - self.assertIn(1, self.graph.get_edges()[3]) + self.assertTrue(1 in self.graph.get_edges()[3]) def test_get_vertices(self): self.assertEqual(self.graph.get_vertices(), [1, 2, 3]) diff --git a/data_structures/graphs/weighted_graph.py b/data_structures/graphs/weighted_graph.py index 2407dfb..0275b65 100644 --- a/data_structures/graphs/weighted_graph.py +++ b/data_structures/graphs/weighted_graph.py @@ -33,11 +33,11 @@ def setUp(self): def test_add_vertex(self): self.graph.add_vertex(4) - self.assertIn(4, self.graph.get_vertices()) + self.assertTrue(4 in self.graph.get_vertices()) def test_add_edge(self): self.graph.add_edge(3, 1, 30) - self.assertIn(1, self.graph.get_edges()[3]) + self.assertTrue(1 in self.graph.get_edges()[3]) self.assertEqual(self.graph.get_edges()[3][1], 30) def test_get_vertices(self): diff --git a/data_structures/map/map.py b/data_structures/map/map.py index 311e855..dd7a85a 100644 --- a/data_structures/map/map.py +++ b/data_structures/map/map.py @@ -111,7 +111,7 @@ def test_len(self): def test_iter(self): keys = {"a", "b", "c"} for k, _v in self.m: - self.assertIn(k, keys) + self.assertTrue(k in keys) def test_str(self): self.assertEqual(str(self.m), "{a: 1, b: 2, c: 3}")