def setUp(self): self.grid = Grid() for row in range(1,10): for column in range(1,10): cell = Cell(row,column) cell.setValues([row,column]) self.grid.setCell(row, column, cell)
def testSetCellGetCell(self): testCell = Cell(1,1) testCell.setValues([1]) currentCell = self.grid.getCell(1,1) self.assertNotEqual(testCell, currentCell, "Incorrect setup, currentCell should not match") self.grid.setCell(1, 1, testCell) newCell = self.grid.getCell(1, 1) self.assertEqual(testCell, newCell, "Cells do not match")
def ImportGrid(file): reader = csv.reader(file) grid = Grid() rowCount = 1 for row in reader: for column in range(1,10): cell = Cell(rowCount,column) value = row[column-1] if value is not "": cell.setValues([int(value)]) grid.setCell(rowCount, column, cell) rowCount = rowCount + 1 return grid