class Gol03Test(unittest.TestCase): field = None cell = None def setUp(self): pass def tearDown(self): pass def testIsCellCreated(self): self.cell = Cell() assert self.cell.exist() == True, 'Cell was not created' def testIsCellAlive(self): self.field = Field() self.coordinate = [0,0] self.field.is_cell_alive(self.coordinate) == False, 'Cell is not alive' def testSetACellAlive(self): self.field = Field() self.coordinate = [0,0] self.field.append(self.coordinate) self.field.is_cell_alive(self.coordinate) == True, 'Cell is not alive' def testDoWeNeedAnotherPeriod(self): field = Field() cell = Cell() cell2 = Cell() field.append(Cell) field.append(cell2) assert field.number_of_neighbours() == 2, 'Field cant count its neighbours'
class Gol02Test(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def testCellCreated(self): self.cell = Cell() assert self.cell.exist() == True, 'Cell was not created' def testCellAddNeighbour(self): self.cell = Cell() self.cell2 = Cell() assert self.cell.add(self.cell2) == self.cell2, 'Cell has no neighbour' def testCellNumberOfNeighbours(self): self.cell = Cell() print self.cell.number_of_neighbours() assert self.cell.number_of_neighbours() == 0, 'Cell does not know about its neighbours' def testCellNumberOfNeighbours2(self): self.cell = Cell() self.cell2 = Cell() self.cell.add(self.cell2) print self.cell.number_of_neighbours() assert self.cell.number_of_neighbours() == 1, 'Cell does not know about its neighbours'