def test_add_zero_valueerror(self): """ Test that adding 0 number of dice raises a ValueError. """ roll = Roll(3) roll.add(0)
def test_add_negative_valueerror(self): """ Test that adding a negative number of dice raises a ValueError. """ roll = Roll(3) roll.add(-3)
def test_add_not_int_valueerror(self): """ Test that adding a non-integer number of dice raises a ValueError. """ roll = Roll(3) roll.add([2, 4, 3])
def test_add_becomes_glitch(self): """ Test that adding dice with glitches causes the roll to become a glitch. """ roll = Roll(3) self.assertFalse(roll.glitch) roll.add(2) self.assertTrue(roll.glitch)
def test_add_gliches_added(self): """ Test that adding dice updates the number of glitches. """ roll = Roll(3) self.assertEquals(roll.glitches, 2) roll.add(3) self.assertEquals(roll.glitches, 3)
def test_add_original_dice_pool_not_increased(self): """ Test that adding dice does not affect the original number of dice. """ roll = Roll(4) self.assertEquals(roll.original_dice_pool, 4) roll.add(3) self.assertEquals(roll.original_dice_pool, 4)
def test_add_dice_pool_increased(self): """ Test that adding dice updates the number of dice. """ roll = Roll(4) self.assertEquals(roll.dice_pool, 4) roll.add(3) self.assertEquals(roll.dice_pool, 7)
def test_add_hits_increased(self): """ Test that adding dice updates the number of hits. """ roll = Roll(3) self.assertEquals(roll.hits, 1) roll.add(3) self.assertEquals(roll.hits, 2)
def test_add_dice_updated(self): """ Test that adding dice updates the dice list. """ roll = Roll(3) self.assertEquals(roll.dice, [1, 3, 5]) roll.add(3) self.assertEquals(roll.dice, [1, 3, 5, 2, 4, 1])
def test_add_becomes_fumble(self): """ Test that adding dice with glitches causes the roll to become a fumble. """ roll = Roll(3) self.assertFalse(roll.fumble) roll.add(2) self.assertTrue(roll.fumble)
def test_reroll_causes_fumble(self): """ Test that reloading resulting in glitches can cause a fumble. """ roll = Roll(3) self.assertFalse(roll.fumble) roll.reroll() self.assertTrue(roll.fumble)
def test_reroll_causes_glitch(self): """ Test that reloading resulting in glitches can cause a glitch. """ roll = Roll(3) self.assertFalse(roll.glitch) roll.reroll() self.assertTrue(roll.glitch)
def test_reroll_glitches_updated(self): """ Test that rerolling updates the number of glitches. """ roll = Roll(4) self.assertEquals(roll.glitches, 2) roll.reroll() self.assertEquals(roll.glitches, 3)
def test_reroll_hits_updated(self): """ Test that rerolling updates the number of hits. """ roll = Roll(4) self.assertEquals(roll.hits, 2) roll.reroll() self.assertEquals(roll.hits, 4)
def test_reroll_hits_unaffected(self): """ Test that rerolling does not affect hits. """ roll = Roll(4) self.assertEquals(roll.dice, [6, 5, 3, 2]) roll.reroll() self.assertEquals(roll.dice, [6, 5, 1, 2])
def test_add_edge_explodes(self): """ Test that adding sixes explode, as they are added using Edge. """ roll = Roll(3) self.assertEquals(roll.dice_pool, 3) roll.add(3) self.assertEquals(roll.dice_pool, 7) self.assertEquals(roll.dice, [6, 2, 3, 6, 1, 4, 1])
def test_reroll_exploded_rerolled(self): """ Test that exploded dice that are not hits are also rerolled. """ roll = Roll(3, edge=True) self.assertEquals(roll.dice, [1, 2, 6, 1]) self.assertEquals(roll.original_dice_pool, 3) self.assertEquals(roll.dice_pool, 4) roll.reroll() self.assertEquals(roll.dice, [6, 3, 4, 5]) self.assertEquals(roll.original_dice_pool, 3) self.assertEquals(roll.dice_pool, 4)
def test_reroll_dont_explode(self): """ Test that rerolled that are sixes dice do not explode. """ roll = Roll(3) self.assertEquals(roll.dice, [1, 2, 6]) self.assertEquals(roll.original_dice_pool, 3) self.assertEquals(roll.dice_pool, 3) roll.reroll() self.assertEquals(roll.dice, [6, 6, 5]) self.assertEquals(roll.original_dice_pool, 3) self.assertEquals(roll.dice_pool, 3)