Spaces:
Running
Running
File size: 1,257 Bytes
df97e68 | 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 33 34 35 36 37 38 39 | from app.engine import LiveSimulationSession, SimulationAgentMode, run_simulation
def test_run_simulation_baseline_policy_end_to_end():
result = run_simulation(
task_id="district_backlog_easy",
agent_mode=SimulationAgentMode.BASELINE_POLICY,
max_steps=12,
seed=123,
policy_name="backlog_clearance",
)
assert result.task_id == "district_backlog_easy"
assert result.agent_mode == SimulationAgentMode.BASELINE_POLICY
assert result.seed == 123
assert isinstance(result.total_reward, float)
assert 0.0 <= result.score <= 1.0
assert isinstance(result.summary, dict)
assert isinstance(result.trace, list)
assert len(result.trace) > 0
def test_live_session_step_once_smoke():
session = LiveSimulationSession(
task_id="district_backlog_easy",
agent_mode=SimulationAgentMode.BASELINE_POLICY,
max_steps=5,
seed=7,
policy_name="backlog_clearance",
)
try:
row, log_line, finished = session.step_once()
assert isinstance(row, dict)
assert isinstance(log_line, str)
assert "[STEP]" in log_line
assert "reward" in row
assert isinstance(finished, bool)
finally:
session.close() |