def test_exceptions_are_displayed_with_messages(): exc = PrefectStateSignal("you did something incorrectly") assert "you did something incorrectly" in repr(exc) assert "PrefectStateSignal" in repr(exc)
def test_signals_create_states_with_results(): with pytest.raises(Exception) as exc: raise PrefectStateSignal("message", result=5) assert isinstance(exc.value.state, State) assert exc.value.state.result == 5 assert exc.value.state.message == "message"
def test_signals_create_states(): with pytest.raises(PrefectSignal) as exc: raise PrefectStateSignal("message") assert isinstance(exc.value.state, State) assert exc.value.state.result is exc.value assert exc.value.state.message == "message"