code: def test_nan_inf_data(binary_string):
      imgs = [np.ones((20, 20)), 255 * np.ones((20, 20))]
      zmaxs = [1, 255]
      for zmax, img in zip(zmaxs, imgs):
          img[0] = 0
          img[10:12] = np.nan
          # the case of 2d/heatmap is handled gracefully by the JS trace but I don't know how to check it
          fig = px.imshow(
              np.dstack((img,) * 3),
              binary_string=binary_string,
              contrast_rescaling="minxmax",
          )
          if not binary_string:
              assert fig.data[0]["zmax"] == (zmax, zmax, zmax, 255)
          else:
              assert fig.data[0]["zmax"] is None
  
imports: import plotly.express
  import numpy
  import pytest
  import xarray
  from PIL import Image
  from io import BytesIO
  import base64
  import datetime
  from plotly.express.imshow_utils import rescale_intensity
label_desc: Use image node_id 8 for calling a global function with example usage: test_nan_inf_data(binary_string) without return types