예제 #1
0
    def test_toomanydice(self):
        with raises(DiceFatalException):
            roll('%id6' % (MAX_ROLL_DICE + 1))

        with raises(DiceFatalException):
            roll('7d6', max_dice=6)

        with raises(ValueError):
            Roll.roll(6, 1, 6, max_dice=4)
예제 #2
0
    def test_toomanydice(self):
        with raises(DiceFatalException):
            roll("%id6" % (MAX_ROLL_DICE + 1))

        with raises(DiceFatalException):
            roll("7d6", max_dice=6)

        with raises(ValueError):
            Roll.roll(6, 1, 6, max_dice=4)
예제 #3
0
    def test_roll(self):
        amount, sides = 6, 6
        assert len(Roll.roll(amount, 1, sides)) == amount

        rr = Roll.roll(amount, 1, sides)
        assert (1 * sides) <= sum(rr) <= (amount * sides)

        rr = roll('%id%i' % (amount, sides))
        rmin, rmax = rr.random_element.min_value, rr.random_element.max_value
        assert rmin <= rr.do_roll_single() <= rmax
예제 #4
0
    def test_roll_error(self):
        with raises(ValueError):
            Roll.roll(-1, 1, 6)

        with raises(ValueError):
            Roll.roll_single(4, 3)

        with raises(DiceFatalException):
            rolled = roll('6d6')
            rolled.do_roll_single(4, 3)
예제 #5
0
    def test_roll(self):
        amount, sides = 6, 6
        assert len(Roll.roll(amount, 1, sides)) == amount

        rr = Roll.roll(amount, 1, sides)
        assert (1 * sides) <= sum(rr) <= (amount * sides)

        rr = roll('%id%i' % (amount, sides))
        rmin, rmax = rr.random_element.min_value, rr.random_element.max_value
        assert rmin <= rr.do_roll_single() <= rmax
예제 #6
0
    def test_roll_error(self):
        with raises(ValueError):
            Roll.roll(-1, 1, 6)

        with raises(ValueError):
            Roll.roll_single(4, 3)

        with raises(DiceFatalException):
            rolled = roll('6d6')
            rolled.do_roll_single(4, 3)
예제 #7
0
 def test_roll(self):
     amount, sides = 6, 6
     assert len(Roll.roll(amount, sides)) == amount
     assert (1 * sides) <= sum(Roll.roll(amount, sides)) <= (amount * sides)
예제 #8
0
 def test_negative_amount_extreme(self):
     with raises(ValueError):
         Roll.roll(-1, 1, 6, force_extreme=DiceExtreme.EXTREME_MAX)
예제 #9
0
 def test_roll(self):
     amount, sides = 6, 6
     assert len(Roll.roll(amount, sides)) == amount
     assert (1 * sides) <= sum(Roll.roll(amount, sides)) <= (amount * sides)
예제 #10
0
 def test_negative_amount_extreme(self):
     with raises(ValueError):
         Roll.roll(-1, 1, 6, force_extreme=DiceExtreme.EXTREME_MAX)