def test_to_excel(tmpdir, request, expected_dir):
    sas_file = request.getfixturevalue(request.param)
    converted_file = Path(tmpdir).joinpath('file1.xlsx')
    expected_file = expected_dir.joinpath('file1.xlsx')
    converter.to_excel(sas_file, converted_file)

    df_expected = pd.read_excel(expected_file)
    df_converted = pd.read_excel(converted_file)

    pd.testing.assert_frame_equal(df_expected, df_converted)
Exemple #2
0
def test_to_excel_str(tmpdir, request, expected_dir):
    sas_file = request.getfixturevalue(request.param)
    converted_file = str(Path(tmpdir).joinpath("file1.xlsx"))
    expected_file = expected_dir.joinpath("file1.xlsx")
    converter.to_excel(sas_file, converted_file)

    df_expected = pd.read_excel(expected_file, engine="openpyxl")
    df_converted = pd.read_excel(converted_file, engine="openpyxl")

    pd.testing.assert_frame_equal(df_expected, df_converted)
def test_to_excel_invalid_extension():
    with pytest.raises(AttributeError) as execinfo:
        converter.to_excel('test.sas7bdat', 'test.bad')

    assert 'sas7bdat conversion error - Valid extension' in str(execinfo.value)