def offset(self, dx, dy, move_absolute=False): (col, row) = cell_name_to_coordinates(self.plainCellName) if move_absolute or not self.colAbsolute: col += dx if move_absolute or not self.rowAbsolute: row += dy newName = coordinates_to_cell_name(col, row, colAbsolute=self.colAbsolute, rowAbsolute=self.rowAbsolute) if newName is None: newName = "#Invalid!" self.localReference = newName + self.whitespace
def offset(self, dx, dy, move_absolute=False): (col, row) = cell_name_to_coordinates(self.plainCellName) if move_absolute or not self.colAbsolute: col += dx if move_absolute or not self.rowAbsolute: row += dy newName = coordinates_to_cell_name(col, row, colAbsolute=self.colAbsolute, rowAbsolute=self.rowAbsolute) if newName is None: newName = "#Invalid!" self.localReference = newName + self.whitespace
def _asCellReference(cellName, worksheetInfo): if cell_name_to_coordinates(cellName): worksheetInfo.append(cellName) return FLCellReference(worksheetInfo)
def coords(self): return cell_name_to_coordinates(self.plainCellName)
def coords(self): return cell_name_to_coordinates(self.plainCellName)
def _asCellReference(cellName, worksheetInfo): if cell_name_to_coordinates(cellName): worksheetInfo.append(cellName) return FLCellReference(worksheetInfo)
def testCellNameTo(self): "test cell_name_to_coordinates" self.assertEquals(cell_name_to_coordinates("A1"), (1, 1), "To coordinates test 1 failed") self.assertEquals(cell_name_to_coordinates("b1"), (2, 1), "To coordinates test 2 failed") self.assertEquals(cell_name_to_coordinates("C5"), (3, 5), "To coordinates test 3 failed") self.assertEquals(cell_name_to_coordinates("ac100"), (29, 100), "To coordinates test 4 failed") self.assertEquals(cell_name_to_coordinates("A1 "), (1, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("She1"), (13057, 1), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("56G"), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("YTGDCJK"), "To coordinates test 6 failed") self.assertIsNone(cell_name_to_coordinates("54688"), "To coordinates test 7 failed") self.assertIsNone(cell_name_to_coordinates(""), "To coordinates test 8 failed") self.assertIsNone(cell_name_to_coordinates("W0mbat"), "To coordinates test 9 failed") self.assertIsNone(cell_name_to_coordinates(" "), "To coordinates test 10 failed") self.assertIsNone(cell_name_to_coordinates(";-)"), "To coordinates test 11 failed") self.assertIsNone(cell_name_to_coordinates(None), "To coordinates test 12 failed") self.assertIsNone(cell_name_to_coordinates("FXSHRXX1"), "Invalid column name") self.assertIsNone(cell_name_to_coordinates("A9223372036854775808"), "Invalid row number")
def testAbsoluteCellName(self): "test absolute cell_name_to_coordinates" self.assertEquals(cell_name_to_coordinates("$A1"), (1, 1), "To coordinates test 1 failed") self.assertEquals(cell_name_to_coordinates("A$1"), (1, 1), "To coordinates test 1 failed") self.assertEquals(cell_name_to_coordinates("$A$1"), (1, 1), "To coordinates test 1 failed") self.assertEquals(cell_name_to_coordinates("$b1"), (2, 1), "To coordinates test 2 failed") self.assertEquals(cell_name_to_coordinates("b$1"), (2, 1), "To coordinates test 2 failed") self.assertEquals(cell_name_to_coordinates("$b$1"), (2, 1), "To coordinates test 2 failed") self.assertEquals(cell_name_to_coordinates("$C5"), (3, 5), "To coordinates test 3 failed") self.assertEquals(cell_name_to_coordinates("C$5"), (3, 5), "To coordinates test 3 failed") self.assertEquals(cell_name_to_coordinates("$C$5"), (3, 5), "To coordinates test 3 failed") self.assertEquals(cell_name_to_coordinates("$ac100"), (29, 100), "To coordinates test 4 failed") self.assertEquals(cell_name_to_coordinates("ac$100"), (29, 100), "To coordinates test 4 failed") self.assertEquals(cell_name_to_coordinates("$ac$100"), (29, 100), "To coordinates test 4 failed") self.assertEquals(cell_name_to_coordinates("$A1 "), (1, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("A$1 "), (1, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("$A$1 "), (1, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("$She1"), (13057, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("She$1"), (13057, 1), "To coordinates test 5 failed") self.assertEquals(cell_name_to_coordinates("$She$1"), (13057, 1), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("$56G"), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("56$G"), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("$56$G"), "To coordinates test 5 failed") self.assertIsNone(cell_name_to_coordinates("$$A1"), "To coordinates test 6 failed") self.assertIsNone(cell_name_to_coordinates("A$$1"), "To coordinates test 6 failed") self.assertIsNone(cell_name_to_coordinates("$YTGDCJK"), "To coordinates test 6 failed") self.assertIsNone(cell_name_to_coordinates("546$88"), "To coordinates test 7 failed") self.assertIsNone(cell_name_to_coordinates(""), "To coordinates test 8 failed") self.assertIsNone(cell_name_to_coordinates("W0m$bat"), "To coordinates test 9 failed") self.assertIsNone(cell_name_to_coordinates(" $ "), "To coordinates test 10 failed") self.assertIsNone(cell_name_to_coordinates(";-$)"), "To coordinates test 11 failed") self.assertIsNone(cell_name_to_coordinates(None), "To coordinates test 12 failed") self.assertIsNone(cell_name_to_coordinates("$FXSHRXX$1"), "Invalid column name") self.assertIsNone(cell_name_to_coordinates("FXSHR$XX1"), "Invalid column name") self.assertIsNone(cell_name_to_coordinates("A$9223372036854775808"), "Invalid row number")