From b917f78ca53a0cb1744e787ddd764d29cb600975 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 29 Jun 2019 09:23:35 -0500 Subject: [PATCH] replace dice sanity checks as asserts --- dice/roller.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dice/roller.py b/dice/roller.py index a03c722..a65192c 100644 --- a/dice/roller.py +++ b/dice/roller.py @@ -93,12 +93,8 @@ class DiceRoller(object): size = m[1] if keep > dice or keep == 0: keep = dice - if size < 1: - output = "# of sides for die is incorrect: %d" % size - return output - if dice < 1: - output = "# of dice is incorrect: %d" % dice - return output + assert size >= 1, f"Die must have at least one side." + assert dice >= 1, f"At least one die must be rolled." res = self.roll_dice(keep, dice, size) curr_str += "%d%s" % (res[0], res[1]) res = res[0]