code: def test_view(unittest):
      from dtale.views import startup
      import dtale.global_state as global_state
  
      global_state.clear_store()
  
      with app.test_client() as c:
          global_state.new_data_inst(c.port)
          startup(URL, data=xarray_data(), data_id=c.port)
          assert global_state.get_dataset(c.port) is not None
  
          response = c.get("/dtale/main/{}".format(c.port))
          assert 'input id="xarray" value="True"' not in str(
              response.data
          )
          assert 'input id="xarray_dim" value="{}"' not in str(
              response.data
          )
  
          resp = c.get("/dtale/code-export/{}".format(c.port))
          assert resp.status_code == 200
          response_data = resp.json
          assert response_data["success"]
  
          resp = c.get("/dtale/xarray-coordinates/{}".format(c.port))
          response_data = resp.json
          expected = [
              {
                  "count": 3,
                  "dtype": "str64" if PY3 else "string16",
                  "name": "location",
              },
              {"count": 731, "dtype": "datetime64[ns]", "name": "time"},
          ]
          unittest.assertEqual(
              sorted(response_data["data"], key=lambda c: c["name"]),
              expected,
          )
  
          resp = c.get(
              "/dtale/xarray-dimension-values/{}/location".format(
                  c.port
              )
          )
          response_data = resp.json
          unittest.assertEqual(
              response_data["data"],
              [{"value": "IA"}, {"value": "IN"}, {"value": "IL"}],
          )
  
          resp = c.get(
              "/dtale/update-xarray-selection/{}".format(c.port),
              query_string=dict(
                  selection=json.dumps(dict(location="IA"))
              ),
          )
          assert resp.status_code == 200
          assert list(
              global_state.get_data(c.port).location.unique()
          ) == ["IA"]
          assert (
              global_state.get_dataset_dim(c.port)["location"] == "IA"
          )
  
          resp = c.get(
              "/dtale/update-xarray-selection/{}".format(c.port),
              query_string=dict(selection=json.dumps(dict())),
          )
          assert resp.status_code == 200
          assert list(
              global_state.get_data(c.port).location.unique()
          ) == [
              "IA",
              "IN",
              "IL",
          ]
  
          resp = c.get("/dtale/code-export/{}".format(c.port))
          assert resp.status_code == 200
          response_data = resp.json
          assert response_data["success"]
  
      with app.test_client() as c:
          zero_dim_xarray = xarray_data().sel(
              location="IA", time="2000-01-01"
          )
          startup(URL, data=zero_dim_xarray, data_id=c.port)
          assert global_state.get_dataset(c.port) is not None
          response = c.get("/dtale/main/{}".format(c.port))
          assert 'input id="xarray" value="True"' not in str(
              response.data
          )
          assert 'input id="xarray_dim" value="{}"' not in str(
              response.data
          )
  
file_path: dtale/tests/dtale/test_xarray.py
imports: import json
  import numpy
  import pandas
  import pytest
  import xarray
  from six import PY3
  from tests.dtale.test_views import app, URL
label_desc: Use image node_id 2 for calling a global function with example usage: test_view(unittest) without return types