code: def test_binary_serialize_datetime():
      x = np.arange("2005-02-25", "2005-03", dtype="datetime64[D]")
      x_ms = np.array(
          [1109289600000, 1109376000000, 1109462400000, 1109548800000],
          dtype=np.int64,
      )
      scatter = bqplot.Scatter(x=x)
  
      state = scatter.get_state()
      assert state["x"]["dtype"] == "float64"
      assert (
          np.array(state["x"]["value"], dtype=np.float64)
          .astype(np.int64)
          .tolist()
          == x_ms.tolist()
      )
  
      x = np.array(
          [
              pd.Timestamp("2005-02-25"),
              pd.Timestamp("2005-02-26"),
              pd.Timestamp("2005-02-27"),
              pd.Timestamp("2005-02-28"),
          ]
      )
      scatter = bqplot.Scatter(x=x)
  
      state = scatter.get_state()
      assert state["x"]["dtype"] == "float64"
      assert (
          np.array(state["x"]["value"], dtype=np.float64)
          .astype(np.int64)
          .tolist()
          == x_ms.tolist()
      )
  
      # currently a roundtrip does not converse the datetime64 type
      scatter2 = bqplot.Scatter()
      scatter2.set_state(state)
  
      assert scatter2.x.dtype.kind == "M"
      assert scatter2.x.astype(np.int64).tolist() == x_ms.tolist()
  
file_path: bqplot/tests/binary_serialization_test.py
imports: import bqplot
  import numpy
  import pandas
  from bqplot.traits import array_to_json, array_from_json
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_serialize_datetime() without return types