def test_format_df_table(): df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}) assert _format_df(df, "table") == df.to_string()
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"))
def test_format_df_illegal_format(): with pytest.raises(ValueError): _format_df(None, "nothing")