Skip to main content

✅ Regression state immutability

CategoryRegression
StatusPassing
Testtests/test_abilities_actions.py::test_regression_state_immutability

execute_ability must return a new GameState without mutating input.

Preconditions

  • P1 has 5 AP, Sabnock READIED, Duban READIED with 0 damage

Action

  • execute_ability(state, sabnock, ...)
result = execute_ability(state, sabnock_on_field, ability_idx=0, targets=[duban_on_field])

Expected Postconditions

  • Original state.players[P1].ap is still 5 (not mutated)

  • Original state has no status effects (not mutated)

  • result is a different object from state

Assertions

assert state.players[Side.PLAYER_1].ap == original_ap
assert len(state.status_effects) == original_effects_count
assert result is not state