code: def test_save_chart(unittest):
      from dtale.dash_application.saved_charts import SAVED_CHART_IDS
  
      config_ids = "...".join(
          [
              "saved-chart-config-{}.data".format(i)
              for i in SAVED_CHART_IDS
          ]
      )
      delete_ids = "...".join(
          ["saved-deletes-{}.data".format(i) for i in SAVED_CHART_IDS]
      )
      delete_clicks = [
          dict(
              id="delete-saved-btn-{}".format(i),
              property="n_clicks",
              value=None,
          )
          for i in SAVED_CHART_IDS
      ]
      configs = [
          dict(
              id="saved-chart-config-{}".format(i),
              property="data",
              value=None,
          )
          for i in SAVED_CHART_IDS
      ]
      deletes = [
          dict(
              id="saved-deletes-{}".format(i),
              property="data",
              value=None,
          )
          for i in SAVED_CHART_IDS
      ]
      with app.test_client() as c:
          params = {
              "output": "..save-clicks.data...{}...{}..".format(
                  config_ids, delete_ids
              ),
              "changedPropIds": ["collapse-data-btn.n_clicks"],
              "inputs": [
                  {"id": "save-btn", "property": "n_clicks", "value": 1}
              ]
              + delete_clicks,
              "state": [
                  {"id": "input-data", "property": "data", "value": {}},
                  {
                      "id": "chart-input-data",
                      "property": "data",
                      "value": {},
                  },
                  {"id": "yaxis-data", "property": "data", "value": {}},
                  {
                      "id": "map-input-data",
                      "property": "data",
                      "value": {},
                  },
                  {
                      "id": "candlestick-input-data",
                      "property": "data",
                      "value": {},
                  },
                  {
                      "id": "treemap-input-data",
                      "property": "data",
                      "value": {},
                  },
                  {"id": "save-clicks", "property": "data", "value": 0},
              ]
              + configs
              + deletes,
          }
          response = c.post(
              "/dtale/charts/_dash-update-component", json=params
          )
          assert response.status_code == 204
  
          input_data = {
              "data_id": str(c.port),
              "chart_type": "line",
              "agg": "sum",
              "x": "a",
              "y": ["b"],
              "yaxis": {},
          }
          params["state"][0]["value"] = input_data
          params["inputs"][0]["value"] = 1
          response = c.post(
              "/dtale/charts/_dash-update-component", json=params
          )
          assert response.status_code == 200
          response = response.json["response"]
          unittest.assertEqual(
              input_data, response["saved-chart-config-1"]["data"]
          )
  
          params["inputs"][0]["value"] = 1
          params["inputs"][1]["value"] = 1
          params["state"][6]["value"] = 1
          response = c.post(
              "/dtale/charts/_dash-update-component", json=params
          )
          response = response.json["response"]
          unittest.assertEqual(
              None, response["saved-chart-config-1"]["data"]
          )
  
file_path: dtale/tests/dtale/dash/test_saved_charts.py
imports: import pandas
  import pytest
  from tests import ExitStack
  from tests.dtale import build_data_inst
  from tests.dtale.test_views import app
  from tests.dtale.dash.test_dash import ts_builder
label_desc: Use image node_id 2 for calling a global function with example usage: test_save_chart(unittest) without return types