code: def test_resample(unittest):
      from dtale.views import build_dtypes_state, format_data
  
      start, end = "2000-10-01 23:30:00", "2000-10-03 00:30:00"
      rng = pd.date_range(start, end, freq="7min")
      ts = pd.Series(np.arange(len(rng)) * 3, index=rng)
      ts2 = pd.Series(np.arange(len(rng)) * 0.32, index=rng)
      df = pd.DataFrame(data={"col1": ts, "col2": ts2})
      df, _ = format_data(df)
  
      global_state.clear_store()
      with app.test_client() as c:
          data = {c.port: df}
          dtypes = {c.port: build_dtypes_state(df)}
          settings = {c.port: {}}
  
          build_data_inst(data)
          build_dtypes(dtypes)
          build_settings(settings)
          reshape_cfg = dict(
              index="index", columns=["col1"], freq="17min", agg="mean"
          )
          resp = c.get(
              "/dtale/reshape/{}".format(c.port),
              query_string=dict(
                  output="new",
                  type="resample",
                  cfg=json.dumps(reshape_cfg),
              ),
          )
  
          response_data = json.loads(resp.data)
          new_key = str(c.port + 1)
          assert response_data["data_id"] == new_key
          assert len(global_state.keys()) == 2
          unittest.assertEqual(
              [d["name"] for d in global_state.get_dtypes(new_key)],
              ["index_17min", "col1"],
          )
          assert len(global_state.get_data(new_key)) == 90
          assert (
              global_state.get_settings(new_key).get("startup_code")
              is not None
          )
          c.get(
              "/dtale/cleanup-datasets",
              query_string=dict(dataIds=new_key),
          )
  
file_path: dtale/tests/dtale/test_reshapers.py
imports: import json
  import pandas
  import numpy
  import pytest
  import dtale.global_state
  from tests.dtale import build_data_inst, build_settings, build_dtypes
  from tests.dtale.test_views import app
label_desc: Use image node_id 5 for calling a global function with example usage: test_resample(unittest) without return types