What it says on the tin, really; but the highlights (other than added test cases) are:
Removed dead code in DicePouch left over from a refactor in ~2013 (more details in c35c24697e424393b53160ad00ea33307dbad5e5's commit message).
Fixed fallthrough from "can't drop the lowest n dice" to outputting a result without dropping anything.
Handle the range of inputs between when eval_equation raises ValueError (really big) and when the result is small enough to calculate but still too big for Python's int -> str conversion.
Refactor control flow and remove responsibility for IRC output from _roll_dice() helper.
[x] I can and do license this contribution under the EFLv2
[x] No issues are reported by make qa (runs make lint and make test)
[x] I have tested the functionality of the things this change touches
Notes
Sadly, I believe 100% test coverage is impossible using @plugin.example alone, without further modifying the plugin's logic. I got sopel/modules/dice.py up to 97%, which is still pretty good. A more in-depth explanation of where I ran into trouble is in the commit message for 7ab4be177f5708a4b5a740a46735b03ff33ae458.
This is easily bumped to 8.0.1 if it takes too long to get settled, but I would rather change the constructor interface of DicePouch in 8.0.0 even though the sopel.modules.* subpackages aren't really part of the public API. The bugfixes are nice, too.
What it says on the tin, really; but the highlights (other than added test cases) are:
DicePouch
left over from a refactor in ~2013 (more details in c35c24697e424393b53160ad00ea33307dbad5e5's commit message).eval_equation
raisesValueError
(really big) and when the result is small enough to calculate but still too big for Python'sint
->str
conversion._roll_dice()
helper.Follow-up to https://github.com/sopel-irc/sopel/pull/2503#issuecomment-1676205118.
Checklist
make qa
(runsmake lint
andmake test
)Notes
Sadly, I believe 100% test coverage is impossible using
@plugin.example
alone, without further modifying the plugin's logic. I gotsopel/modules/dice.py
up to 97%, which is still pretty good. A more in-depth explanation of where I ran into trouble is in the commit message for 7ab4be177f5708a4b5a740a46735b03ff33ae458.This is easily bumped to 8.0.1 if it takes too long to get settled, but I would rather change the constructor interface of
DicePouch
in 8.0.0 even though thesopel.modules.*
subpackages aren't really part of the public API. The bugfixes are nice, too.