Skip to content

Commit

Permalink
update save name for these
Browse files Browse the repository at this point in the history
  • Loading branch information
lf-zhao committed Jan 15, 2025
1 parent 0a7518c commit 89645d6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
13 changes: 7 additions & 6 deletions tests/mock_robot/test_mock_env_cup_emptiness.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_with_belief_observe_cup_emptiness():
}

# Plan and visualize transitions
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=f'Transition Graph, {test_name.replace("_", " ").title()}')

# Verify transition graph file exists
graph_file = Path(test_dir) / "transitions" / "transition_graph.png"
Expand Down Expand Up @@ -285,10 +285,11 @@ def test_with_belief_plan_check_and_pick_cup():
}

# Plan and visualize transitions
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
name = f'Transition Graph, {test_name.replace("_", " ").title()}'
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=name)

# Verify transition graph file exists
graph_file = Path(test_dir) / "transitions" / "transition_graph.png"
graph_file = Path(test_dir) / "transitions" / f"{name}.png"
assert graph_file.exists(), "Transition graph file not generated"

# Cleanup
Expand Down Expand Up @@ -384,7 +385,7 @@ def test_with_belief_plan_check_and_place_cup():
}

# Plan and visualize transitions
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=f'Transition Graph, {test_name.replace("_", " ").title()}')

# Verify transition graph file exists
graph_file = Path(test_dir) / "transitions" / "transition_graph.png"
Expand Down Expand Up @@ -472,7 +473,7 @@ def test_view_pick_and_place_cup():
}

# Plan and visualize transitions
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=f'Transition Graph, {test_name.replace("_", " ").title()}')

# Verify transition graph file exists
graph_file = Path(test_dir) / "transitions" / "transition_graph.png"
Expand Down Expand Up @@ -592,7 +593,7 @@ def test_observe_two_cups_and_place_empty():
}

# Plan and visualize transitions
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
env_creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=f'Transition Graph, {test_name.replace("_", " ").title()}')

# Verify transition graph file exists
graph_file = Path(test_dir) / "transitions" / "transition_graph.png"
Expand Down
3 changes: 2 additions & 1 deletion tests/mock_robot/test_mock_env_graph_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def test_transitions_match_edges():
}

# Plan and visualize first to generate the graph
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=test_name)
name = f'Transition Graph, {test_name.replace("_", " ").title()}'
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=name)

# Get all possible operator transitions
transitions = creator.get_operator_transitions(initial_atoms, objects)
Expand Down
19 changes: 13 additions & 6 deletions tests/mock_robot/test_mock_env_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from rich.console import Console
from rich.logging import RichHandler
import logging
from pathlib import Path

# Configure rich logging
logging.basicConfig(
Expand Down Expand Up @@ -166,10 +167,12 @@ def test_single_block_pick_place():
}

# Plan and visualize transitions
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
name = f'Transition Graph, {test_name.replace("_", " ").title()}'
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=name)

# Verify output file exists
assert os.path.exists(os.path.join(creator.transitions_dir, "transition_graph.png"))
graph_file = Path(os.path.join("mock_env_data", test_name)) / "transitions" / f"{name}.png"
assert graph_file.exists(), "Transition graph file not generated"


def test_two_object_pick_place():
Expand Down Expand Up @@ -266,10 +269,12 @@ def test_two_object_pick_place():
}

# Plan and visualize transitions
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
name = f'Transition Graph, {test_name.replace("_", " ").title()}'
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=name)

# Verify output file exists
assert os.path.exists(os.path.join(creator.transitions_dir, "transition_graph.png"))
graph_file = Path(os.path.join("mock_env_data", test_name)) / "transitions" / f"{name}.png"
assert graph_file.exists(), "Transition graph file not generated"


def test_view_reach_pick_place_two_objects():
Expand Down Expand Up @@ -367,7 +372,9 @@ def test_view_reach_pick_place_two_objects():
}

# Plan and visualize transitions
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
name = f'Transition Graph, {test_name.replace("_", " ").title()}'
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=name)

# Verify output file exists
assert os.path.exists(os.path.join(creator.transitions_dir, "transition_graph.png"))
graph_file = Path(os.path.join("mock_env_data", test_name)) / "transitions" / f"{name}.png"
assert graph_file.exists(), "Transition graph file not generated"
2 changes: 1 addition & 1 deletion tests/mock_robot/test_mock_env_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_view_operators():
}

# Plan and visualize transitions
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name="transition_graph")
creator.plan_and_visualize(initial_atoms, goal_atoms, objects, task_name=f'Transition Graph, {test_name.replace("_", " ").title()}')

# Verify output file exists
assert os.path.exists(os.path.join(creator.transitions_dir, "transition_graph.png"))

0 comments on commit 89645d6

Please sign in to comment.