code: def test_main(unittest):
      props = [
          "host",
          "port",
          "debug",
          "subprocess",
          "data_loader",
          "reaper_on",
          "show_columns",
          "hide_columns",
          "sort",
      ]
      with mock.patch(
          "dtale.cli.script.show", mock.Mock()
      ) as mock_show:
          csv_path = os.path.join(
              os.path.dirname(__file__), "..", "data/test_df.csv"
          )
          args = [
              "--host",
              "test",
              "--port",
              "9999",
              "--csv-path",
              csv_path,
          ]
          args += [
              "--show-columns",
              "a,b",
              "--hide-columns",
              "c",
              "--sort",
              "a|ASC",
          ]
          script.main(args, standalone_mode=False)
          mock_show.assert_called_once()
          _, kwargs = mock_show.call_args
          (
              host,
              port,
              debug,
              subprocess,
              data_loader,
              reaper_on,
              show_columns,
              hide_columns,
              sort,
          ) = map(kwargs.get, props)
          assert host == "test"
          assert not subprocess
          assert not debug
          assert port == 9999
          assert reaper_on
          assert data_loader is not None
          unittest.assertEqual(show_columns, ["a", "b"])
          unittest.assertEqual(hide_columns, ["c"])
          unittest.assertEqual(sort, [("a", "ASC")])
  
      with ExitStack() as stack:
          mock_show = stack.enter_context(
              mock.patch("dtale.cli.script.show", mock.Mock())
          )
          mock_find_free_port = stack.enter_context(
              mock.patch(
                  "dtale.cli.script.find_free_port",
                  mock.Mock(return_value=9999),
              )
          )
          csv_path = os.path.join(
              os.path.dirname(__file__), "..", "data/test_df.csv"
          )
          args = ["--csv-path", csv_path, "--debug", "--no-reaper"]
          script.main(args, standalone_mode=False)
          mock_show.assert_called_once()
          mock_find_free_port.assert_called_once()
          _, kwargs = mock_show.call_args
          (
              host,
              port,
              debug,
              subprocess,
              data_loader,
              reaper_on,
              show_columns,
              hide_columns,
              sort,
          ) = map(kwargs.get, props)
          assert host is None
          assert not subprocess
          assert debug
          assert port == 9999
          assert not reaper_on
          assert data_loader is not None
          assert show_columns is None
          assert hide_columns is None
          assert sort is None
          df = data_loader()
          pdt.assert_frame_equal(
              df,
              pd.DataFrame([dict(a=1, b=2, c=3)]),
              "loader should load csv",
          )
  
      if PY3 and check_pandas_version("0.25.0"):
          with ExitStack() as stack:
              mock_show = stack.enter_context(
                  mock.patch("dtale.cli.script.show", mock.Mock())
              )
              mock_find_free_port = stack.enter_context(
                  mock.patch(
                      "dtale.cli.script.find_free_port",
                      mock.Mock(return_value=9999),
                  )
              )
              xlsx_path = os.path.join(
                  os.path.dirname(__file__), "..", "data/test_df.xlsx"
              )
              args = [
                  "--excel-path",
                  xlsx_path,
                  "--debug",
                  "--no-reaper",
              ]
              script.main(args, standalone_mode=False)
              mock_show.assert_called_once()
              mock_find_free_port.assert_called_once()
              _, kwargs = mock_show.call_args
              (
                  host,
                  port,
                  debug,
                  subprocess,
                  data_loader,
                  reaper_on,
                  show_columns,
                  hide_columns,
                  sort,
              ) = map(kwargs.get, props)
              assert host is None
              assert not subprocess
              assert debug
              assert port == 9999
              assert not reaper_on
              assert data_loader is not None
              assert show_columns is None
              assert hide_columns is None
              assert sort is None
              df = data_loader()
              pdt.assert_frame_equal(
                  df,
                  pd.DataFrame([dict(a=1, b=2, c=3)]),
                  "loader should load xlsx",
              )
  
      with mock.patch(
          "dtale.cli.script.show", mock.Mock()
      ) as mock_show:
          json_path = os.path.join(
              os.path.dirname(__file__), "..", "data/test_df.json"
          )
          args = [
              "--host",
              "test",
              "--port",
              "9999",
              "--json-path",
              json_path,
          ]
          script.main(args, standalone_mode=False)
          mock_show.assert_called_once()
          _, kwargs = mock_show.call_args
          (
              host,
              port,
              debug,
              subprocess,
              data_loader,
              reaper_on,
              show_columns,
              hide_columns,
              sort,
          ) = map(kwargs.get, props)
          assert host == "test"
          assert not subprocess
          assert not debug
          assert port == 9999
          assert reaper_on
          assert data_loader is not None
          assert show_columns is None
          assert hide_columns is None
          assert sort is None
          df = data_loader()
          pdt.assert_frame_equal(
              df,
              pd.DataFrame([dict(a=1, b=2, c=3)]),
              "loader should load json",
          )
  
      pytest.importorskip("pyarrow")
  
      with mock.patch(
          "dtale.cli.script.show", mock.Mock()
      ) as mock_show:
          parquet_path = os.path.join(
              os.path.dirname(__file__), "..", "data/test_df.parquet"
          )
          args = [
              "--host",
              "test",
              "--port",
              "9999",
              "--parquet-path",
              parquet_path,
          ]
          script.main(args, standalone_mode=False)
          mock_show.assert_called_once()
          _, kwargs = mock_show.call_args
          (
              host,
              port,
              debug,
              subprocess,
              data_loader,
              reaper_on,
              show_columns,
              hide_columns,
              sort,
          ) = map(kwargs.get, props)
          assert host == "test"
          assert not subprocess
          assert not debug
          assert port == 9999
          assert reaper_on
          assert data_loader is not None
          assert show_columns is None
          assert hide_columns is None
          assert sort is None
          df = data_loader()
          pdt.assert_frame_equal(
              df,
              pd.DataFrame(dict(a=[1, 2, 3], b=[4, 5, 6])),
              "loader should load parquet",
          )
  
imports: import os
  import sys
  from imp import reload
  import mock
  import pandas
  import pytest
  from six import PY3
  from dtale.cli import loaders, script
  from dtale.cli.clickutils import run
  from dtale.pandas_util import check_pandas_version
  from tests import ExitStack, pdt
label_desc: Use image node_id 1 for calling a global function with example usage: test_main(unittest) without return types