Replace Poll runtime assertions
This commit is contained in:
@@ -483,7 +483,8 @@ def transition_poll(
|
||||
elif action == "close":
|
||||
poll.closed_at = now
|
||||
elif action == "decide":
|
||||
assert decision_option is not None
|
||||
if decision_option is None:
|
||||
raise PollError("A decide transition requires a poll option")
|
||||
poll.decided_option_id = decision_option.id
|
||||
poll.decided_at = now
|
||||
if poll.closed_at is None:
|
||||
|
||||
@@ -137,7 +137,8 @@ class PollTransitionEngine:
|
||||
raise ValueError("Archived poll has no valid status to restore")
|
||||
else:
|
||||
target_status = archived_from_status
|
||||
assert target_status is not None
|
||||
if target_status is None:
|
||||
raise ValueError(f"Poll transition {action!r} did not resolve a target status")
|
||||
return PollTransitionPlan(action=action, from_status=current_status, to_status=target_status)
|
||||
|
||||
def available_actions(
|
||||
|
||||
Reference in New Issue
Block a user