def test_xlsx_input_utf8(self): """This is an xlsx file saved by OpenOffice. It seems to use UTF8 internally.""" xlsxinput = XLSXInput( input_name='flattentool/tests/fixtures/xlsx/unicode.xlsx', main_sheet_name='main') xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines())[0]['id'] == 'éαГ😼𝒞人'
def test_xlsx_input_integer(self): xlsxinput = XLSXInput(input_name='flattentool/tests/fixtures/xlsx/integer.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 1}] assert xlsxinput.sub_sheet_names == []
def test_xlsx_input(self): xlsxinput = XLSXInput(input_name='flattentool/tests/fixtures/xlsx/basic.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 'cell1', 'colB': 'cell2'}, {'colA': 'cell3', 'colB': 'cell4'}] assert xlsxinput.sub_sheet_names == ['subsheet'] assert list(xlsxinput.get_sheet_lines('subsheet')) == \ [{'colC': 'cell5', 'colD': 'cell6'}, {'colC': 'cell7', 'colD': 'cell8'}]
def test_xlsx_input_integer(self): xlsxinput = XLSXInput( input_name='flattentool/tests/fixtures/xlsx/integer.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 1}] assert xlsxinput.sub_sheet_names == []
def test_xlsx_input(self): xlsxinput = XLSXInput( input_name='flattentool/tests/fixtures/xlsx/basic.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 'cell1', 'colB': 'cell2'}, {'colA': 'cell3', 'colB': 'cell4'}] assert xlsxinput.sub_sheet_names == ['subsheet'] assert list(xlsxinput.get_sheet_lines('subsheet')) == \ [{'colC': 'cell5', 'colD': 'cell6'}, {'colC': 'cell7', 'colD': 'cell8'}]
def test_xlsx_input_formula(self): """ When a forumla is present, we should use the value, rather than the formula itself. """ xlsxinput = XLSXInput(input_name='flattentool/tests/fixtures/xlsx/formula.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 1, 'colB': 2}, {'colA': 2, 'colB': 4}] assert xlsxinput.sub_sheet_names == ['subsheet'] assert list(xlsxinput.get_sheet_lines('subsheet')) == \ [{'colC': 3, 'colD': 9}, {'colC': 4, 'colD': 12}]
def test_xlsx_input_formula(self): """ When a forumla is present, we should use the value, rather than the formula itself. """ xlsxinput = XLSXInput( input_name='flattentool/tests/fixtures/xlsx/formula.xlsx', main_sheet_name='main') assert xlsxinput.main_sheet_name == 'main' xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines()) == \ [{'colA': 1, 'colB': 2}, {'colA': 2, 'colB': 4}] assert xlsxinput.sub_sheet_names == ['subsheet'] assert list(xlsxinput.get_sheet_lines('subsheet')) == \ [{'colC': 3, 'colD': 9}, {'colC': 4, 'colD': 12}]
def test_xlsx_input_utf8(self): """This is an xlsx file saved by OpenOffice. It seems to use UTF8 internally.""" xlsxinput = XLSXInput(input_name='flattentool/tests/fixtures/xlsx/unicode.xlsx', main_sheet_name='main') xlsxinput.read_sheets() assert list(xlsxinput.get_main_sheet_lines())[0]['id'] == 'éαГ😼𝒞人'