Create test_loacal.py
Browse files- test_loacal.py +20 -0
test_loacal.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick local test - runs in <5 seconds"""
|
| 2 |
+
from server.my_env_environment import MyEnvEnvironment
|
| 3 |
+
from models import IncidentAction
|
| 4 |
+
from graders import get_grader
|
| 5 |
+
|
| 6 |
+
print("Testing OpenOps environment...")
|
| 7 |
+
|
| 8 |
+
for task_id in [1, 2, 3]:
|
| 9 |
+
env = MyEnvEnvironment()
|
| 10 |
+
env.reset(task_id=task_id)
|
| 11 |
+
|
| 12 |
+
# Take a few actions
|
| 13 |
+
env.step(IncidentAction(action_id=0, task_id=task_id))
|
| 14 |
+
env.step(IncidentAction(action_id=1, task_id=task_id))
|
| 15 |
+
|
| 16 |
+
grader = get_grader(task_id)
|
| 17 |
+
score = grader(env)
|
| 18 |
+
print(f"Task {task_id}: Environment working ✅ (test score: {score:.2f})")
|
| 19 |
+
|
| 20 |
+
print("\n✅ All tests passed!")
|