code: def test_build_agg_data(unittest, rolling_data):
      import dtale.views as views
  
      df, _ = views.format_data(rolling_data)
      extended_aggregation = [
          dict(col="0", agg="mean"),
          dict(col="0", agg="sum"),
          dict(col="1", agg="mean"),
      ]
      output, code, cols = chart_utils.build_agg_data(
          df,
          "date",
          ["0", "1"],
          {},
          None,
          extended_aggregation=extended_aggregation,
      )
      unittest.assertEqual(
          sorted(output.columns),
          [
              build_col_def("mean", "0"),
              build_col_def("sum", "0"),
              build_col_def("mean", "1"),
              "date",
          ],
      )
      unittest.assertEqual(
          sorted(cols),
          [
              build_col_def("mean", "0"),
              build_col_def("sum", "0"),
              build_col_def("mean", "1"),
          ],
      )
  
      output, code, cols = chart_utils.build_agg_data(
          df, "date", ["0", "1"], {}, "mean"
      )
      unittest.assertEqual(
          list(output.columns),
          [
              "date",
              build_col_def("mean", "0"),
              build_col_def("mean", "1"),
          ],
      )
      unittest.assertEqual(
          cols, [build_col_def("mean", "0"), build_col_def("mean", "1")]
      )
  
      output, code, cols = chart_utils.build_agg_data(
          df, "date", ["0", "1"], {}, "drop_duplicates"
      )
      unittest.assertEqual(
          list(output.columns),
          [
              "index",
              "date",
              build_col_def("drop_duplicates", "0"),
              build_col_def("drop_duplicates", "1"),
          ],
      )
      unittest.assertEqual(
          cols,
          [
              build_col_def("drop_duplicates", "0"),
              build_col_def("drop_duplicates", "1"),
          ],
      )
  
      extended_aggregation = [
          dict(col="0", agg="mean"),
          dict(col="0", agg="pctsum"),
          dict(col="1", agg="mean"),
          dict(col="1", agg="first"),
      ]
      output, code, cols = chart_utils.build_agg_data(
          df,
          "date",
          ["0", "1"],
          {},
          None,
          extended_aggregation=extended_aggregation,
      )
      unittest.assertEqual(
          sorted(list(output.columns)),
          [
              build_col_def("mean", "0"),
              build_col_def("pctsum", "0"),
              build_col_def("first", "1"),
              build_col_def("mean", "1"),
              "date",
          ],
      )
      unittest.assertEqual(
          sorted(cols),
          [
              build_col_def("mean", "0"),
              build_col_def("pctsum", "0"),
              build_col_def("first", "1"),
              build_col_def("mean", "1"),
          ],
      )
  
file_path: dtale/tests/dtale/charts/test_utils.py
imports: import mock
  import pytest
  import dtale.charts.utils
  from tests import ExitStack
  from tests.dtale.test_charts import build_col_def
label_desc: Use image node_id 7 for calling a global function with example usage: test_build_agg_data(unittest, rolling_data) without return types