예제 #1
0
def test_format_df_table():
    df = pd.DataFrame({'col1': [1, 2],
                       'col2': [3, 4]})
    assert _format_df(df, "table") == df.to_string()
예제 #2
0
def test_format_df_records():
    df = pd.DataFrame({'col1': [1, 2],
                       'col2': [3, 4]})
    assert _format_df(df, "records") == str(df.to_dict(orient="records"))
예제 #3
0
def test_format_df_illegal_format():
    with pytest.raises(ValueError):
        _format_df(None, "nothing")