code: def test_get_correlations(unittest, test_data, rolling_data):
      import dtale.views as views
  
      with app.test_client() as c:
          test_data, _ = views.format_data(test_data)
          build_data_inst({c.port: test_data})
          build_dtypes({c.port: views.build_dtypes_state(test_data)})
          response = c.get("/dtale/correlations/{}".format(c.port))
          response_data = response.get_json()
          expected = dict(
              data=[
                  dict(
                      column="security_id",
                      security_id=1.0,
                      foo=None,
                      bar=None,
                  ),
                  dict(
                      column="foo", security_id=None, foo=None, bar=None
                  ),
                  dict(
                      column="bar", security_id=None, foo=None, bar=None
                  ),
              ],
              dates=[],
              pps=None,
              dummyColMappings={},
              strings=["baz"],
          )
          unittest.assertEqual(
              {k: v for k, v in response_data.items() if k != "code"},
              expected,
              "should return correlations",
          )
          unittest.assertEqual(response_data["code"], CORRELATIONS_CODE)
  
          response = c.get(
              "/dtale/correlations/{}".format(c.port),
              query_string={"encodeStrings": True},
          )
          response_data = response.get_json()
          unittest.assertEqual(
              response_data["dummyColMappings"], {"baz": ["baz_baz"]}
          )
  
      with app.test_client() as c:
          build_data_inst({c.port: test_data})
          build_dtypes({c.port: views.build_dtypes_state(test_data)})
          settings = {c.port: {"query": "missing_col == 'blah'"}}
          build_settings(settings)
          response = c.get("/dtale/correlations/{}".format(c.port))
          response_data = response.get_json()
          unittest.assertEqual(
              response_data["error"],
              "name 'missing_col' is not defined",
              "should handle correlations exception",
          )
  
      with app.test_client() as c:
          test_data.loc[test_data.security_id == 1, "bar"] = np.nan
          test_data2 = test_data.copy()
          test_data2.loc[:, "date"] = pd.Timestamp("20000102")
          test_data = pd.concat(
              [test_data, test_data2], ignore_index=True
          )
          build_data_inst({c.port: test_data})
          build_dtypes({c.port: views.build_dtypes_state(test_data)})
          response = c.get("/dtale/correlations/{}".format(c.port))
          response_data = response.get_json()
          expected = dict(
              data=[
                  dict(
                      column="security_id",
                      security_id=1.0,
                      foo=None,
                      bar=None,
                  ),
                  dict(
                      column="foo", security_id=None, foo=None, bar=None
                  ),
                  dict(
                      column="bar", security_id=None, foo=None, bar=None
                  ),
              ],
              dates=[dict(name="date", rolling=False)],
              pps=None,
              dummyColMappings={},
              strings=["baz"],
          )
          unittest.assertEqual(
              {k: v for k, v in response_data.items() if k != "code"},
              expected,
              "should return correlations",
          )
  
      df, _ = views.format_data(rolling_data)
      with app.test_client() as c:
          build_data_inst({c.port: df})
          build_dtypes({c.port: views.build_dtypes_state(df)})
          response = c.get("/dtale/correlations/{}".format(c.port))
          response_data = response.get_json()
          unittest.assertEqual(
              response_data["dates"],
              [dict(name="date", rolling=True)],
              "should return correlation date columns",
          )
  
      with app.test_client() as c:
          build_data_inst({c.port: df})
          build_dtypes({c.port: views.build_dtypes_state(df)})
          response = c.get(
              "/dtale/correlations/{}".format(c.port),
              query_string=dict(image=True),
          )
          assert response.content_type == "image/png"
  
file_path: dtale/tests/dtale/correlations/test_views.py
imports: import numpy
  import pandas
  import json
  import platform
  import pytest
  from pkg_resources import parse_version
  import dtale.pandas_util
  from dtale.charts.utils import CHART_POINTS_LIMIT
  from tests.dtale.test_views import app, build_ts_data
  from tests.dtale import build_data_inst, build_settings, build_dtypes
label_desc: Use image node_id 2 for calling a global function with example usage: test_get_correlations(unittest, test_data, rolling_data) without return types