diff --git a/tests/digraph/test_nodes.py b/tests/digraph/test_nodes.py index c61640c56..eab992607 100644 --- a/tests/digraph/test_nodes.py +++ b/tests/digraph/test_nodes.py @@ -76,6 +76,12 @@ def test_remove_nodes_from_with_invalid_index(self): self.assertEqual(["a"], res) self.assertEqual([0], dag.node_indexes()) + def test_has_node(self): + dag = rustworkx.PyDAG() + node_a = dag.add_node("a") + self.assertTrue(dag.has_node(node_a)) + self.assertFalse(dag.has_node(node_a + 1)) + def test_remove_nodes_retain_edges_single_edge(self): dag = rustworkx.PyDAG() node_a = dag.add_node("a") @@ -85,7 +91,6 @@ def test_remove_nodes_retain_edges_single_edge(self): res = dag.nodes() self.assertEqual(["a", "c"], res) self.assertEqual([0, 2], dag.node_indexes()) - self.assertTrue(dag.has_node(node_a)) self.assertTrue(dag.has_edge(node_a, node_c)) self.assertEqual(dag.get_all_edge_data(node_a, node_c), ["Edgy"]) @@ -98,7 +103,6 @@ def test_remove_nodes_retain_edges_single_edge_outgoing_weight(self): res = dag.nodes() self.assertEqual(["a", "c"], res) self.assertEqual([0, 2], dag.node_indexes()) - self.assertTrue(dag.has_node(node_a)) self.assertTrue(dag.has_edge(node_a, node_c)) self.assertEqual(dag.get_all_edge_data(node_a, node_c), ["Edgy_mk2"]) diff --git a/tests/graph/test_nodes.py b/tests/graph/test_nodes.py index 6eb65c1ca..f81b82373 100644 --- a/tests/graph/test_nodes.py +++ b/tests/graph/test_nodes.py @@ -179,3 +179,9 @@ def test_remove_node_delitem_invalid_index(self): res = graph.nodes() self.assertEqual(["a", "b", "c"], res) self.assertEqual([0, 1, 2], graph.node_indexes()) + + def test_has_node(self): + graph = rustworkx.PyGraph() + node_a = graph.add_node("a") + self.assertTrue(graph.has_node(node_a)) + self.assertFalse(graph.has_node(node_a + 1))