def test_evaluate_drop_with_dice_token_values(mocker): mock_random = mocker.patch("dice.tokens.mt_rand") mock_random.side_effect = [2, 5, 1, 4, 3] dice_token = Dice(sides=6, rolls=5) operator = Drop(dice_token, 2) actual = operator.evaluate() assert actual == [3, 4, 5] assert operator.result == [3, 4, 5] assert actual == operator.result mock_random.assert_has_calls([ mocker.call(min=1, max=6), mocker.call(min=1, max=6), mocker.call(min=1, max=6), mocker.call(min=1, max=6), mocker.call(min=1, max=6), ])
def test_evaluate_drop_with_scalar_values(): operator = Drop([5, 2, 1, 4], 2) actual = operator.evaluate() assert actual == [4, 5] assert operator.result == [4, 5] assert actual == operator.result