code: def test_imshow_source_dtype_zmax(dtype, contrast_rescaling):
      img = np.arange(100, dtype=dtype).reshape((10, 10))
      fig = px.imshow(
          img, binary_string=True, contrast_rescaling=contrast_rescaling
      )
      if contrast_rescaling == "minmax":
          assert (
              np.max(
                  np.abs(
                      rescale_intensity(
                          img, in_range="image", out_range=np.uint8
                      )
                      - decode_image_string(fig.data[0].source)
                  )
              )
              < 1
          )
      else:
          if dtype in [np.uint8, np.float32, np.float64]:
              assert np.all(
                  img == decode_image_string(fig.data[0].source)
              )
          else:
              assert (
                  np.abs(
                      np.max(decode_image_string(fig.data[0].source))
                      - 255 * img.max() / np.iinfo(dtype).max
                  )
                  < 1
              )
  
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 20 for calling a global function with example usage: test_imshow_source_dtype_zmax(dtype, contrast_rescaling) without return types