File size: 849 Bytes
21c7db9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from app.env.env_core import PolyGuardEnv


def test_env_reset_deterministic_patient_id() -> None:
    env = PolyGuardEnv()
    obs1 = env.reset(seed=123, difficulty="easy")
    pid1 = obs1.patient_summary["patient_id"]
    contract1 = obs1.deterministic_contract
    obs2 = env.reset(seed=123, difficulty="easy")
    pid2 = obs2.patient_summary["patient_id"]
    contract2 = obs2.deterministic_contract
    assert pid1 == pid2
    assert contract1["seed"] == contract2["seed"] == 123
    assert contract1["difficulty"] == contract2["difficulty"] == "easy"


def test_env_reset_with_explicit_sub_environment() -> None:
    env = PolyGuardEnv()
    obs = env.reset(seed=9, difficulty="hard", sub_environment="LONGITUDINAL_DEPRESCRIBING")
    assert obs.sub_environment.value == "LONGITUDINAL_DEPRESCRIBING"
    assert obs.step_budget_remaining <= 10