File size: 675 Bytes
f95cbd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import json
from pathlib import Path
import runpy


def test_certified_update_example(capsys):
    root=Path(__file__).resolve().parents[1]
    runpy.run_path(str(root/"examples/certified_update.py"),run_name="__main__")
    result=json.loads(capsys.readouterr().out)
    assert result["accepted"]
    assert result["audit"]["lower_gain_bound"]>0
    assert result["confidence_attempts"]==1


def test_data_schema():
    root=Path(__file__).resolve().parents[1]
    rows=[json.loads(s) for s in (root/"data/exact_match_prompts.jsonl").read_text().splitlines()]
    assert len(rows)==4
    assert all(isinstance(x["prompt"],str) and isinstance(x["answer"],str) for x in rows)