File size: 746 Bytes
9c74dfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from __future__ import annotations

import json
from pathlib import Path

from eval.compose_task_routed_proxy_summary import _load_records


def test_load_records_can_select_specific_label(tmp_path: Path) -> None:
    path = tmp_path / "benchmark.json"
    payload = {
        "benchmark_config": {"controller": "model"},
        "iter8_bag": {
            "episode_records": [{"task_name": "bag", "success": 0.4}],
        },
        "iter9_bag": {
            "episode_records": [{"task_name": "bag", "success": 0.5}],
        },
    }
    path.write_text(json.dumps(payload), encoding="utf-8")

    label, records = _load_records(path, "iter9_bag")

    assert label == "iter9_bag"
    assert records == [{"task_name": "bag", "success": 0.5}]