code: def test_transpose(custom_data, unittest):
      from dtale.views import build_dtypes_state
  
      global_state.clear_store()
      with app.test_client() as c:
          data = {c.port: custom_data}
          dtypes = {c.port: build_dtypes_state(custom_data)}
          settings = {c.port: {}}
  
          build_data_inst(data)
          build_dtypes(dtypes)
          build_settings(settings)
          reshape_cfg = dict(index=["security_id"], columns=["Col0"])
          resp = c.get(
              "/dtale/reshape/{}".format(c.port),
              query_string=dict(
                  output="new",
                  type="transpose",
                  cfg=json.dumps(reshape_cfg),
              ),
          )
          response_data = json.loads(resp.data)
          new_key = str(c.port + 1)
          assert "error" in response_data
  
          min_date = custom_data["date"].min().strftime("%Y-%m-%d")
          global_state.set_settings(
              c.port, dict(query="date == '{}'".format(min_date))
          )
          reshape_cfg = dict(
              index=["date", "security_id"], columns=["Col0"]
          )
          resp = c.get(
              "/dtale/reshape/{}".format(c.port),
              query_string=dict(
                  output="new",
                  type="transpose",
                  cfg=json.dumps(reshape_cfg),
              ),
          )
          response_data = json.loads(resp.data)
          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",
                  "{} 00:00:00 100000".format(min_date),
                  "{} 00:00:00 100001".format(min_date),
              ],
          )
          assert len(global_state.get_data(new_key)) == 1
          assert (
              global_state.get_settings(new_key).get("startup_code")
              is not None
          )
          c.get(
              "/dtale/cleanup-datasets",
              query_string=dict(dataIds=new_key),
          )
  
          reshape_cfg = dict(index=["date", "security_id"])
          resp = c.get(
              "/dtale/reshape/{}".format(c.port),
              query_string=dict(
                  output="override",
                  type="transpose",
                  cfg=json.dumps(reshape_cfg),
              ),
          )
          response_data = json.loads(resp.data)
          assert response_data["data_id"] == str(c.port)
  
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 4 for calling a global function with example usage: test_transpose(custom_data, unittest) without return types