File size: 853 Bytes
b67668b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
import json
from src.agent.offline_runner import run_offline_agent

def test_offline_runner_fails_then_passes():
    bad = json.dumps({
        "employees": [{
            "user_id": "101",   # wrong type
            "name": "",         # invalid (min length)
            "department": "ai"  # invalid enum
        }]
    })

    good = json.dumps({
        "employees": [{
            "user_id": 101,
            "name": "Michael Chen",
            "age": 29,
            "email": None,
            "salary": 120000,
            "join_date": None,
            "department": "Artificial Intelligence",
            "performance_score": None,
            "location": None,
            "job_title": None
        }]
    })

    out = run_offline_agent("raw", [bad, good], max_attempts=2)
    assert out["result"] is not None
    assert len(out["log"]) >= 3