示例#1
0
文件: test_tpl.py 项目: srngit/pyfas
def test_to_excel():
    tpl = Tpl("FC1_rev01.tpl")
    tpl.to_excel()
    assert "FC1_rev01_tpl.xlsx" in os.listdir()
    xl = xlrd.open_workbook("FC1_rev01_tpl.xlsx")
    sh = xl.sheet_by_index(0)
    assert sh.cell_value(3, 4) == 9.973300e+06
    os.remove("FC1_rev01_tpl.xlsx")
    tpl.to_excel("/tmp")
    assert "FC1_rev01_tpl.xlsx" in os.listdir("/tmp")
    os.remove("/tmp/FC1_rev01_tpl.xlsx")
示例#2
0
def test_to_excel():
    tpl = Tpl(TEST_FLD+"/FC1_rev01.tpl")
    tpl.to_excel()
    assert "FC1_rev01_tpl.xlsx" in os.listdir(TEST_FLD)
    xl = xlrd.open_workbook(TEST_FLD+"/FC1_rev01_tpl.xlsx")
    sh = xl.sheet_by_index(0)
    assert sh.cell_value(3, 4) == 9.973300e+06
    os.remove(TEST_FLD+"/FC1_rev01_tpl.xlsx")
    temp_folder = tempfile.gettempdir()
    tpl.to_excel(temp_folder)
    assert "FC1_rev01_tpl.xlsx" in os.listdir(temp_folder)
    os.remove(temp_folder+"/FC1_rev01_tpl.xlsx")