Exemplo n.º 1
0
 def test_get_xml_path_function(self):
     """Should return an xml path in the same directory as the xlsx file"""
     xlsx_path = "/home/user/Desktop/xlsform.xlsx"
     expected = "/home/user/Desktop/xlsform.xml"
     assert expected == get_xml_path(xlsx_path)
     # check that it also handles spaced routes
     xlsx_path = "/home/user/Desktop/my xlsform.xlsx"
     expected = "/home/user/Desktop/my xlsform.xml"
     assert expected == get_xml_path(xlsx_path)
Exemplo n.º 2
0
 def test_get_xml_path_function(self):
     """Should return an xml path in the same directory as the xlsx file"""
     xlsx_path = "/home/user/Desktop/xlsform.xlsx"
     expected = "/home/user/Desktop/xlsform.xml"
     assert expected == get_xml_path(xlsx_path)
     # check that it also handles spaced routes
     xlsx_path = "/home/user/Desktop/my xlsform.xlsx"
     expected = "/home/user/Desktop/my xlsform.xml"
     assert expected == get_xml_path(xlsx_path)
Exemplo n.º 3
0
    def test_xls2xform_convert__e2e_row_with_no_column_value(self):
        """Programmatically-created XLSX files may have rows without column values"""
        md = """
        | survey |        |        |        |         |
        |        | type   | name   | label  | hint    |
        |        | text   | state  | State  |         |
        |        | text   | city   | City   | A hint  |
        """
        wb = md_table_to_workbook(md)
        with get_temp_dir() as tmp:
            wb_path = os.path.join(tmp, "empty_cell.xlsx")
            wb.save(wb_path)
            wb.close()
            xls2xform_convert(
                xlsform_path=wb_path,
                xform_path=get_xml_path(wb_path),
            )

            xform_path = os.path.join(tmp, "empty_cell.xml")
            self.assertTrue(os.path.exists(xform_path))