Check for "/" in feature names (#660)

This commit is contained in:
Thomas Lips
2025-01-29 21:54:49 +01:00
committed by GitHub
parent 4323bdce22
commit c4d912a241
2 changed files with 24 additions and 0 deletions

View File

@@ -414,3 +414,20 @@ def test_create_branch():
# Clean
api.delete_repo(repo_id, repo_type=repo_type)
def test_dataset_feature_with_forward_slash_raises_error():
# make sure dir does not exist
from lerobot.common.datasets.lerobot_dataset import LEROBOT_HOME
dataset_dir = LEROBOT_HOME / "lerobot/test/with/slash"
# make sure does not exist
if dataset_dir.exists():
dataset_dir.rmdir()
with pytest.raises(ValueError):
LeRobotDataset.create(
repo_id="lerobot/test/with/slash",
fps=30,
features={"a/b": {"dtype": "float32", "shape": 2, "names": None}},
)