File size: 974 Bytes
77da5ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import pytest
from core.lifestack_env import LifeStackEnv

def test_env_reset_consistency():
    """Verify that calling reset() multiple times produces a consistent stable state."""
    env = LifeStackEnv()
    
    # Reset 1
    obs1 = env.reset()
    metrics1 = env.state.current_metrics.flatten()
    
    # Reset 2
    obs2 = env.reset()
    metrics2 = env.state.current_metrics.flatten()
    
    for key in metrics1:
        assert metrics1[key] == metrics2[key], f"Metric {key} inconsistent after multiple resets"

def test_env_reset_custom_conflict():
    """Verify that custom primary disruptions are applied correctly during reset."""
    env = LifeStackEnv()
    custom_conflict = {"career.workload": 20.0, "mental_wellbeing.stress_level": 15.0}
    
    env.reset(conflict=custom_conflict)
    flat = env.state.current_metrics.flatten()
    
    assert flat["career.workload"] > 70.0  # Base is usually 70
    assert flat["mental_wellbeing.stress_level"] > 70.0