code: def check_span(x, cmap, how, sol):
      # Copy inputs that will be modified
      sol = sol.copy()
      if isinstance(x, xr.DataArray) and isinstance(x.data, da.Array):
          x = x.compute()
      else:
          x = x.copy()
  
      # All data no span
      img = tf.shade(x, cmap=cmap, how=how, span=None)
      assert_eq_xr(img, sol)
  
      # All data with span
      img = tf.shade(x, cmap=cmap, how=how, span=float_span)
      assert_eq_xr(img, sol)
  
      # Decrease smallest. This value should be clipped to span[0] and the
      # resulting image should be identical
      x[0, 1] = 10
      x_input = x.copy()
      img = tf.shade(x, cmap=cmap, how=how, span=float_span)
      assert_eq_xr(img, sol)
  
      # Check that clipping doesn't alter input array
      x.equals(x_input)
  
      # Increase largest. This value should be clipped to span[1] and the
      # resulting image should be identical
      x[2, 1] = 18
      x_input = x.copy()
      img = tf.shade(x, cmap=cmap, how=how, span=float_span)
      assert_eq_xr(img, sol)
  
      # Check that clipping doesn't alter input array
      x.equals(x_input)
  
      # zero out smallest. If span is working properly the zeroed out pixel
      # will be masked out and all other pixels will remain unchanged
      x[0, 1] = 0 if x.dtype.kind in ("i", "u") else np.nan
      img = tf.shade(x, cmap=cmap, how=how, span=float_span)
      sol[0, 1] = sol[0, 0]
      assert_eq_xr(img, sol)
  
      # zero out the largest value
      x[2, 1] = 0 if x.dtype.kind in ("i", "u") else np.nan
      img = tf.shade(x, cmap=cmap, how=how, span=float_span)
      sol[2, 1] = sol[0, 0]
      assert_eq_xr(img, sol)
  
imports: from __future__ import annotations
  from io import BytesIO
  import numpy
  import xarray
  import dask.array
  import PIL
  import pytest
  import datashader.transfer_functions
  from datashader.tests.test_pandas import assert_eq_ndarray, assert_eq_xr, assert_image_close
label_desc: Use image node_id 4 for calling a global function with example usage: check_span(x, cmap, how, sol) without return types