diff --git a/pyiron_workflow/node.py b/pyiron_workflow/node.py index 89285018..0266936f 100644 --- a/pyiron_workflow/node.py +++ b/pyiron_workflow/node.py @@ -183,7 +183,7 @@ class Node(HasToDict, ABC, metaclass=AbstractHasPost): owning this, if any. ready (bool): Whether the inputs are all ready and the node is neither already running nor already failed. - root (Node): The parent-most node in this graph. + graph_root (Node): The parent-most node in this graph. run_args (dict): **Abstract** the argmuments to use for actually running the node. Must be specified in child classes. running (bool): Whether the node has called :meth:`run` and has not yet @@ -318,9 +318,9 @@ def parent(self, new_parent: Composite | None) -> None: ) @property - def root(self) -> Node: + def graph_root(self) -> Node: """The parent-most node in this graph.""" - return self if self.parent is None else self.parent.root + return self if self.parent is None else self.parent.graph_root @property def readiness_report(self) -> str: diff --git a/tests/unit/test_composite.py b/tests/unit/test_composite.py index b3750227..a9df414c 100644 --- a/tests/unit/test_composite.py +++ b/tests/unit/test_composite.py @@ -598,24 +598,24 @@ def test_root(self): self.assertIs( top, - top.root, - msg="The parent-most node should be its own root." + top.graph_root, + msg="The parent-most node should be its own graph_root." ) self.assertIs( top, - top.middle_composite.root, - msg="The parent-most node should be the root." + top.middle_composite.graph_root, + msg="The parent-most node should be the graph_root." ) self.assertIs( top, - top.middle_function.root, - msg="The parent-most node should be the root." + top.middle_function.graph_root, + msg="The parent-most node should be the graph_root." ) self.assertIs( top, - top.middle_composite.deep_node.root, - msg="The parent-most node should be the root, recursively accessible from " - "all depths." + top.middle_composite.deep_node.graph_root, + msg="The parent-most node should be the graph_root, recursively accessible " + "from all depths." ) diff --git a/tests/unit/test_node.py b/tests/unit/test_node.py index f17c6a8d..7372b811 100644 --- a/tests/unit/test_node.py +++ b/tests/unit/test_node.py @@ -348,8 +348,9 @@ def test_root(self): n = ANode("n") self.assertIs( n, - n.root, - msg="Lone nodes should be their own root, as there is no parent above." + n.graph_root, + msg="Lone nodes should be their own graph_root, as there is no parent " + "above." )