code: def run_and_check_enhancement(func, data, expected, **kwargs):
      """Perform basic checks that apply to multiple tests."""
      from trollimage.xrimage import XRImage
  
      pre_attrs = data.attrs
      img = XRImage(data)
      func(img, **kwargs)
  
      assert isinstance(img.data.data, da.Array)
      old_keys = set(pre_attrs.keys())
      # It is OK to have "enhancement_history" added
      new_keys = set(img.data.attrs.keys()) - {"enhancement_history"}
      assert old_keys == new_keys
  
      res_data_arr = img.data
      assert isinstance(res_data_arr, xr.DataArray)
      assert isinstance(res_data_arr.data, da.Array)
      res_data = (
          res_data_arr.data.compute()
      )  # mimics what xrimage geotiff writing does
      assert not isinstance(res_data, da.Array)
      np.testing.assert_allclose(
          res_data, expected, atol=1.0e-6, rtol=0
      )
  
imports: import contextlib
  import os
  from tempfile import NamedTemporaryFile
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from satpy.enhancements import create_colormap, on_dask_array, on_separate_bands, using_map_blocks
label_desc: Use image node_id 1 for calling a global function with example usage: run_and_check_enhancement(func, data, expected) without return types