def testMoveCar(self): body = StubBox2dCarBody() cms = StubCarMovingStrategy() car = Car(body) car.setMovingStrategy(cms) self.assertFalse(cms.moveCarCall) car.move(5) self.assertTrue(cms.moveCarCall) self.assertEquals(car, cms.car) self.assertEquals(5, cms.dx)
def testMoveCarAfterBlow(self): car = Car(StubBox2dCarBody()) car.setMovingStrategy(StubCarMovingStrategy()) car.blow((0, 1), (1, 0)) self.assertRaises(CarError, lambda: car.move(1))