From 2338c93f1587151884274ad87912b6f05dd30cab Mon Sep 17 00:00:00 2001 From: Bartok9 Date: Wed, 29 Jul 2026 01:52:56 -0400 Subject: [PATCH] fix(bench): reject empty MoveObjectsToLeftTask obj_types --- .../tasks/move_object_to_left_task.py | 6 +++++- .../tasks/test_move_to_left_task.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/rai_bench/rai_bench/manipulation_o3de/tasks/move_object_to_left_task.py b/src/rai_bench/rai_bench/manipulation_o3de/tasks/move_object_to_left_task.py index 239306acd..ac81ca623 100644 --- a/src/rai_bench/rai_bench/manipulation_o3de/tasks/move_object_to_left_task.py +++ b/src/rai_bench/rai_bench/manipulation_o3de/tasks/move_object_to_left_task.py @@ -35,7 +35,11 @@ def __init__(self, obj_types: List[str], logger: loggers_type | None = None): A list of object types to be moved. """ super().__init__(logger=logger) - self.obj_types = obj_types + if not obj_types: + raise ValueError("obj_types must be a non-empty list") + if not all(isinstance(x, str) and x.strip() for x in obj_types): + raise ValueError("obj_types must contain non-empty strings") + self.obj_types = list(obj_types) @property def task_prompt(self) -> str: diff --git a/tests/rai_bench/manipulation_o3de/tasks/test_move_to_left_task.py b/tests/rai_bench/manipulation_o3de/tasks/test_move_to_left_task.py index 4d683434e..42c1c862c 100644 --- a/tests/rai_bench/manipulation_o3de/tasks/test_move_to_left_task.py +++ b/tests/rai_bench/manipulation_o3de/tasks/test_move_to_left_task.py @@ -43,3 +43,15 @@ def test_calculate_other_types() -> None: correct, incorrect = task.calculate_correct([e1, e2]) assert correct == 1 assert incorrect == 0 + +import pytest + + +def test_reject_empty_obj_types() -> None: + with pytest.raises(ValueError): + MoveObjectsToLeftTask([]) + + +def test_reject_blank_obj_type() -> None: + with pytest.raises(ValueError): + MoveObjectsToLeftTask(["red_cube", " "])