def test_save_return_table_write(df, output_type, path):
    '''
    Test of the utils.save_return_table function for case wehn write to
    disk
    '''
    utils.save_return_table(df, output_type, path=path)
    filehandle = open(path)
    try:
        assert filehandle.read() is not None
    except UnicodeDecodeError:
        from openpyxl import load_workbook
        wb = load_workbook(filename=path)
        assert wb is not None
    filehandle.close()
def test_save_return_table_df():
    '''
    Test that can return dataframe from utils.test_save_return_table
    '''
    dict1 = {'var1': [1, 2, 3, 4, 5], 'var2': [2, 4, 6, 8, 10]}
    df1 = pd.DataFrame.from_dict(dict1)
    test_df = utils.save_return_table(df1)
    assert isinstance(test_df, pd.DataFrame)
def test_save_return_table_exception():
    '''
    Test that can return dataframe from utils.test_save_return_table
    '''
    dict1 = {'var1': [1, 2, 3, 4, 5], 'var2': [2, 4, 6, 8, 10]}
    df1 = pd.DataFrame.from_dict(dict1)
    with pytest.raises(Exception):
        assert utils.save_return_table(df1, output_type='xls',
                                       path='filename.tex')
def test_save_return_table(df, output_type, precision):

    test_str = utils.save_return_table(df, output_type, None, precision)
    assert isinstance(test_str, str)