From f3cf2c2b8b4ee031ac056e8fb2ca99bcc4483d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=AFs=20F=C3=A9d=C3=A9rico?= Date: Fri, 2 Feb 2024 20:51:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E2=9C=85=20Fix=20call=20on=20gr?= =?UTF-8?q?aphless=20behaviors=20Call=20graph=20expect=20graphs=20to=20be?= =?UTF-8?q?=20already=20built?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hebg/call_graph.py | 2 +- tests/test_call_graph.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hebg/call_graph.py b/src/hebg/call_graph.py index 28e24eb..a189620 100644 --- a/src/hebg/call_graph.py +++ b/src/hebg/call_graph.py @@ -64,7 +64,7 @@ def call_nodes( # Search for name reference in all_behaviors if node.name in heb_graph.all_behaviors: node = heb_graph.all_behaviors[node.name] - if not hasattr(node, "graph"): + if not hasattr(node, "_graph") or node._graph is None: action = node(observation) break self._extend_frontiere(node.graph.roots, heb_graph=node.graph) diff --git a/tests/test_call_graph.py b/tests/test_call_graph.py index 8958338..0cf048e 100644 --- a/tests/test_call_graph.py +++ b/tests/test_call_graph.py @@ -185,6 +185,7 @@ def build_graph(self) -> HEBGraph: return graph sub_behavior = SubBehavior() + sub_behavior.graph root_behavior = RootBehavior() root_behavior.graph.all_behaviors["SubBehavior"] = sub_behavior