Datasets:
Download tests/test_planbench.py from Nabidnur/RoboRACE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/datasets/Nabidnur/RoboRACE-Bench/resolve/main/tests/test_planbench.py
- Command line
-
hf download hf://datasets/Nabidnur/RoboRACE-Bench/tests/test_planbench.py
-
curl -L -o test_planbench.py https://huggingface.co/datasets/Nabidnur/RoboRACE-Bench/resolve/main/tests/test_planbench.py
1.38 kB
| import pytest | |
| pd = pytest.importorskip("pandas") | |
| from robotics.planbench.blocksworld import parse_plan, validate # noqa: E402 | |
| DATA = "data/raw/planbench/task1.parquet" | |
| def test_parser_ignores_prose_and_accepts_formats(): | |
| txt = ("We need to stack it on top of the others. First I will pick up stuff.\n" | |
| "[PLAN]\n1. unstack the yellow block from on top of the orange block\n" | |
| "2) put down the yellow block.\n- (pick-up red)\n**stack the red block on top of the blue block**\n" | |
| "[PLAN END]\nextra: pick up the blue block") | |
| assert parse_plan(txt) == [("unstack", "yellow", "orange"), ("put-down", "yellow"), | |
| ("pick-up", "red"), ("stack", "red", "blue")] | |
| assert parse_plan("feast object a from object b\nsuccumb object a") == [("unstack", "a", "b"), ("put-down", "a")] | |
| def test_validator_accepts_all_ground_truth_and_rejects_truncations(domain): | |
| d = pd.read_parquet(DATA) | |
| s = d[d.domain == domain] | |
| assert all(validate(r.query, domain, parse_plan(r.ground_truth_plan))[0] for _, r in s.iterrows()) | |
| assert not any(validate(r.query, domain, parse_plan(r.ground_truth_plan)[:-1])[0] for _, r in s.iterrows()) | |