from __future__ import annotations from arbitrade.risk.kill_switch import KillSwitch def test_kill_switch_can_activate_and_deactivate() -> None: kill_switch = KillSwitch() assert not kill_switch.is_active assert kill_switch.reason is None kill_switch.activate(reason="manual") assert kill_switch.is_active assert kill_switch.reason == "manual" kill_switch.deactivate() assert not kill_switch.is_active assert kill_switch.reason is None def test_kill_switch_active_on_init_sets_reason() -> None: kill_switch = KillSwitch(active=True) assert kill_switch.is_active assert kill_switch.reason == "manual"