code: def test_fast_track_finite_arrays(self):
      # if NaN or Infinity is found in the json dump
      # of a figure, it is decoded and re-encoded to replace these values
      # with null. This test checks that NaN and Infinity values are
      # indeed converted to null, and that the encoding of figures
      # without inf or nan is faster (because we can avoid decoding
      # and reencoding).
      z = np.random.randn(100, 100)
      x = np.arange(100.0)
      fig_1 = go.Figure(go.Heatmap(z=z, x=x))
      t1 = time()
      json_str_1 = _json.dumps(fig_1, cls=utils.PlotlyJSONEncoder)
      t2 = time()
      x[0] = np.nan
      x[1] = np.inf
      fig_2 = go.Figure(go.Heatmap(z=z, x=x))
      t3 = time()
      json_str_2 = _json.dumps(fig_2, cls=utils.PlotlyJSONEncoder)
      t4 = time()
      assert t2 - t1 < t4 - t3
      assert "null" in json_str_2
      assert "NaN" not in json_str_2
      assert "Infinity" not in json_str_2
      x = np.arange(100.0)
      fig_3 = go.Figure(go.Heatmap(z=z, x=x))
      fig_3.update_layout(title_text="Infinity")
      t5 = time()
      json_str_3 = _json.dumps(fig_3, cls=utils.PlotlyJSONEncoder)
      t6 = time()
      assert t2 - t1 < t6 - t5
      assert "Infinity" in json_str_3
  
imports: import datetime
  import math
  import decimal
  from datetime import datetime
  from unittest import TestCase
  from time import time
  import pytest
  import numpy
  import pandas
  import pytz
  from pandas.testing import assert_series_equal
  import json
  import os
  import base64
  from plotly import optional_imports, utils
  import plotly.graph_objects
  from plotly.graph_objs import Scatter, Scatter3d, Figure, Data
  from plotly.utils import get_by_path
  from PIL import Image
label_desc: Use image node_id 23 for calling the TestJSONEncoder obj's underlying member method code with example usage: obj.test_fast_track_finite_arrays() without return types