Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/rai_bench/manipulation_o3de/tasks/test_move_to_left_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", " "])
Loading