Skip to content

Commit

Permalink
πŸ› βœ… Fix call on graphless behaviors
Browse files Browse the repository at this point in the history
Call graph expect graphs to be already built
  • Loading branch information
MathΓ―s FΓ©dΓ©rico committed Feb 2, 2024
1 parent 5abde84 commit f3cf2c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hebg/call_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/test_call_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f3cf2c2

Please sign in to comment.