-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_state_details.py
More file actions
32 lines (27 loc) · 1.2 KB
/
test_state_details.py
File metadata and controls
32 lines (27 loc) · 1.2 KB
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
32
import requests
import json
try:
response = requests.get("http://localhost:5000/api/state")
if response.status_code == 200:
data = response.json()
print("✅ API Response OK")
# Check for new fields
if "agents_details" in data:
print(f"✅ 'agents_details' found. Count: {len(data['agents_details'])}")
if data['agents_details']:
first_agent = data['agents_details'][0]
print(f" First agent sample: {first_agent}")
required = ['id', 'energy', 'temp', 'valence']
if all(k in first_agent for k in required):
print("✅ Agent details structure correct.")
else:
print("❌ Missing fields in agent details.")
else:
print("❌ 'agents_details' missing from response.")
# Check backward compatibility (optional but good to know)
if "total_energy" not in data: # We removed it
print("ℹ️ 'total_energy' removed as expected.")
else:
print(f"❌ API Error: {response.status_code}")
except Exception as e:
print(f"❌ Connection failed: {e}")