File size: 874 Bytes
54c192e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Validate the public dataset structure and answer keys."""
import json
from pathlib import Path

path = Path(__file__).resolve().parent / "test.jsonl"
rows = [json.loads(line) for line in path.read_text().splitlines()]
assert len(rows) == 60 and len({row["task_id"] for row in rows}) == 60
assert sum(row["question_count"] for row in rows) == 70
for row in rows:
    state = json.loads(row["state_json"])
    questions = json.loads(row["questions_json"])
    gold = json.loads(row["gold_json"])
    assert isinstance(state, dict) and set(questions) == set(gold)
    assert row["question_count"] == len(questions)
    for qid, spec in questions.items():
        if spec["type"] == "choice":
            assert gold[qid] in spec["criteria"]
        else:
            assert spec["type"] == "noul" and isinstance(gold[qid], bool)
print("Validated 60 tasks and 70 questions")