Replace Poll runtime assertions

This commit is contained in:
2026-07-21 03:16:24 +02:00
parent 2c776437b4
commit 83d04d2f33
2 changed files with 4 additions and 2 deletions

View File

@@ -483,7 +483,8 @@ def transition_poll(
elif action == "close": elif action == "close":
poll.closed_at = now poll.closed_at = now
elif action == "decide": 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_option_id = decision_option.id
poll.decided_at = now poll.decided_at = now
if poll.closed_at is None: if poll.closed_at is None:

View File

@@ -137,7 +137,8 @@ class PollTransitionEngine:
raise ValueError("Archived poll has no valid status to restore") raise ValueError("Archived poll has no valid status to restore")
else: else:
target_status = archived_from_status 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) return PollTransitionPlan(action=action, from_status=current_status, to_status=target_status)
def available_actions( def available_actions(