def testBlow(self): explosion = Explosion(1.5) blowingObject = StubBlowingObject() blowingObject.setPosition(1.0, 0.0) explosion.setBlowingObject(blowingObject) explosion.setVolume(ExplosionVolume_Hight) self.assertFalse(blowingObject.blowCall) explosion.blow() self.assertTrue(explosion.isBlowing()) self.assertTrue(blowingObject.blowCall) self.assertEquals((0.0, ExplosionVolume_Hight), blowingObject.blowVector) self.assertEquals((1.5, 1.0), blowingObject.blowPosition)
def testMoveBowingExplosion(self): explosion = Explosion(2) explosion.setMovingStrategy(StubExplosionMovingStrategy()) explosion.setBlowingObject(StubBlowingObject()) explosion.blow() self.assertRaises(ExplosionError, lambda: explosion.move(1))
def testSetVolumeOnBlowingExplosion(self): explosion = Explosion(2) explosion.setBlowingObject(StubBlowingObject()) explosion.blow() self.assertRaises(ExplosionError, lambda: explosion.setVolume(ExplosionVolume_Normal))
def testTwiceBlow(self): explosion = Explosion(2) explosion.setBlowingObject(StubBlowingObject()) explosion.blow() self.assertRaises(ExplosionError, lambda: explosion.blow())