def test_fill_formula(self): sheet = ExportSheet(ExportModel.from_json(ExportTestFixtures.model_1_json), 0) sheet.set_reference("a", fixed_row=True, fixed_col=True) sheet.current_row = 10 sheet.current_col = 5 sheet.set_reference("b") sheet.current_row = 1 sheet.current_col = 1 sheet.fill_formula("[a]*[b]", 3, 5, "my_number") assert TestSheet.count_cells(sheet, row=1, col=1, formula="=A1*F11") == 1 assert TestSheet.count_cells(sheet, row=2, col=2, formula="=A1*G12") == 1 assert TestSheet.count_cells(sheet, row=3, col=5, formula="=A1*J13") == 1 assert TestSheet.count_cells(sheet, format_name="my_number") == 15
def test_bump_row(self): sheet = ExportSheet(ExportModel.from_json(ExportTestFixtures.model_1_json), 0) assert sheet.current_col == 0 sheet.current_col = 3 sheet.current_row = 4 sheet.bump_row(2) assert sheet.current_row == 6 assert sheet.current_col == 0
def test_set_reference(self): sheet = ExportSheet(ExportModel.from_json(ExportTestFixtures.model_1_json), 0) sheet.current_row = 3 sheet.current_col = 4 sheet.set_reference("my_ref", fixed_row=True, fixed_col=False, offset_row=3, offset_col=4) assert sheet.references["[my_ref]"] == [6, 8, True, False]