|
5 | 5 |
|
6 | 6 | sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) |
7 | 7 | from jupyddl.automated_planner import AutomatedPlanner |
8 | | -from jupyddl.node import Node |
| 8 | +from jupyddl.node import Node, Path |
9 | 9 |
|
10 | 10 |
|
11 | 11 | def test_node_equality_cost(): |
@@ -36,3 +36,25 @@ def test_node_equality_no_cost(): |
36 | 36 | assertion2 = next_node < next_node_v2 |
37 | 37 |
|
38 | 38 | assert assertion and assertion2 |
| 39 | + |
| 40 | +def test_stringified_node(): |
| 41 | + apla = AutomatedPlanner( |
| 42 | + "pddl-examples/dinner/domain.pddl", "pddl-examples/dinner/problem.pddl" |
| 43 | + ) |
| 44 | + actions = apla.available_actions(apla.initial_state) |
| 45 | + for act in actions: |
| 46 | + next_state = apla.transition(apla.initial_state, act) |
| 47 | + next_node = Node(next_state, apla, heuristic_based=True) |
| 48 | + assert "<PyCall.jlwrap PDDL.State" not in str(next_node) and "Set(Julog.Term" not in str(next_node) |
| 49 | + |
| 50 | +def test_stringified_path(): |
| 51 | + apla = AutomatedPlanner( |
| 52 | + "pddl-examples/dinner/domain.pddl", "pddl-examples/dinner/problem.pddl" |
| 53 | + ) |
| 54 | + actions = apla.available_actions(apla.initial_state) |
| 55 | + path = [] |
| 56 | + for act in actions: |
| 57 | + next_state = apla.transition(apla.initial_state, act) |
| 58 | + path.append(Node(next_state, apla, heuristic_based=True)) |
| 59 | + |
| 60 | + assert "<PyCall.jlwrap PDDL.State" not in str(Path(path)) and "Set(Julog.Term" not in str(Path(path)) |
0 commit comments