File size: 916 Bytes
aa3a171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# test_websocket.py
from client import SQLDebugEnv

def test():
    # Use WebSocket URL
    env = SQLDebugEnv(base_url="ws://localhost:8000")
    
    try:
        for task_id in ["syntax_fix_002", "logic_fix_002", "optimize_002", "pipeline_audit_001"]:
            print(f"\n{'='*60}")
            print(f"Testing: {task_id}")
            
            # Connect and reset
            result = env.reset(task_id=task_id)
            obs = result.observation
            
            print(f"✓ task_id: {obs.task_id}")
            print(f"✓ description: {obs.target_description[:50]}...")
            print(f"✓ query: {obs.current_query[:60]}...")
            
            # Try one step
            from models import SQLDebugAction
            result = env.step(SQLDebugAction(query="SELECT 1"))
            print(f"✓ step reward: {result.reward}")
            
    finally:
        env.close()

test()