def __init__(self): #setupTestLogging(logging.DEBUG) setupTestLogging(logging.INFO) configPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data/game.ini") Application.__init__(self, configPath) PySGE.engine = MySpriteEngine( PySGE.configuration.getScreenSize(), PySGE.configuration.getName(), PySGE.configuration.getResourcePath(), PySGE.eventManager )
newLouse = self.louse.move() self.assertTrue(self.grid.has(2, 2, self.louse)) self.assertEquals(5, self.louse._life) self.assertEquals(0, self.louse._milk) lice = [(x,y) for x, y in self.grid.square(2, 2) if self.grid.has(x, y, newLouse)] self.assertEquals(1, len(lice)) self.assertEquals(4, newLouse._life) self.assertEquals(0, newLouse._milk) def test01c(self): """ lice strive on grass; they reproduce and produce milk """ self.grid.put(2, 2, Grass(self.grid)) self.grid.put(2, 2, self.louse) self.louse.prepareToMove() self.assertEquals(9, self.louse._life) newLouse = self.louse.move() self.assertTrue(self.grid.has(2, 2, self.louse)) self.assertEquals(5, self.louse._life) self.assertEquals(1, self.louse._milk) lice = [(x,y) for x, y in self.grid.square(2, 2) if self.grid.has(x, y, newLouse)] self.assertEquals(1, len(lice)) self.assertEquals(4, newLouse._life) self.assertEquals(0, newLouse._milk) if __name__ == "__main__": import logging from pysge.utils.logger import setupTestLogging setupTestLogging(logging.DEBUG) unittest.main()