code: def test_formatters(unittest):
      formatters = utils.JSONFormatter()
      formatters.add_string(0, name="str")
      formatters.add_int(1, name="int")
      formatters.add_float(2, name="float")
      formatters.add_date(3, name="date")
      formatters.add_timestamp(4, name="timestamp")
      formatters.add_json(5, name="json")
      formatters.add_date(6, name="ts_date")
  
      date = pd.Timestamp("20180430").tz_localize("US/Eastern")
      timestamp = pd.Timestamp("20180430 12:36:44.000001").tz_localize(
          "US/Eastern"
      )
      data = [["hello", 1, 1.6666666, date, date, {"a": 1}, timestamp]]
      unittest.assertEqual(
          formatters.format_dicts(data),
          [
              {
                  "int": 1,
                  "date": "2018-04-30",
                  "float": 1.666667,
                  "str": "hello",
                  "timestamp": 1525060800000,
                  "json": {"a": 1},
                  "ts_date": "2018-04-30 12:36:44.000001",
              }
          ],
      )
      bad_data = [
          [None, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]
      ]
      unittest.assertEqual(
          formatters.format_dicts(bad_data),
          [
              {
                  "int": "",
                  "date": "",
                  "float": "",
                  "str": "",
                  "timestamp": "",
                  "json": None,
                  "ts_date": "",
              }
          ],
      )
      bad_data = [
          [
              "hello",
              "hello",
              "hello",
              "hello",
              "hello",
              "hello",
              "hello",
          ]
      ]
      unittest.assertEqual(
          formatters.format_dicts(bad_data),
          [
              {
                  "int": "",
                  "date": "",
                  "float": "",
                  "str": "hello",
                  "timestamp": "",
                  "json": "hello",
                  "ts_date": "",
              }
          ],
      )
  
      unittest.assertEqual(
          formatters.format_lists(
              pd.DataFrame(
                  data,
                  columns=[
                      "str",
                      "int",
                      "float",
                      "date",
                      "timestamp",
                      "json",
                      "ts_date",
                  ],
              )
          ),
          {
              "int": [1],
              "timestamp": [1525075200000],
              "float": [1.666667],
              "ts_date": ["2018-04-30 16:36:44.000001"],
              "json": [{"a": 1}],
              "str": ["hello"],
              "date": ["2018-04-30 04:00:00"],
          },
      )
  
file_path: dtale/tests/dtale/test_utils.py
imports: from collections import namedtuple
  import mock
  import numpy
  import pandas
  import pytest
  from six import PY3
  import dtale.utils
  from tests import ExitStack
label_desc: Use image node_id 3 for calling a global function with example usage: test_formatters(unittest) without return types