class_docstr: Class for testing enhancements in satpy.enhancements.
class_docstr_tok: ["Class","for","testing","enhancements","in","satpy.enhancements","."]
docstr: Test merging colormaps.
code: def test_merge_colormaps(self):
      """Test merging colormaps."""
      from trollimage.colormap import Colormap
  
      from satpy.enhancements import _merge_colormaps as mcp
      from satpy.enhancements import create_colormap
  
      ret_map = mock.MagicMock()
  
      create_colormap_mock = mock.Mock(wraps=create_colormap)
      cmap1 = Colormap((1, (1.0, 1.0, 1.0)))
      kwargs = {"palettes": cmap1}
  
      with mock.patch(
          "satpy.enhancements.create_colormap", create_colormap_mock
      ):
          res = mcp(kwargs)
      assert res is cmap1
      create_colormap_mock.assert_not_called()
      create_colormap_mock.reset_mock()
      ret_map.reset_mock()
  
      cmap1 = {"colors": "blues", "min_value": 0, "max_value": 1}
      kwargs = {"palettes": [cmap1]}
      with mock.patch(
          "satpy.enhancements.create_colormap", create_colormap_mock
      ), mock.patch("trollimage.colormap.blues", ret_map):
          _ = mcp(kwargs)
      create_colormap_mock.assert_called_once()
      ret_map.reverse.assert_not_called()
      ret_map.set_range.assert_called_with(0, 1)
      create_colormap_mock.reset_mock()
      ret_map.reset_mock()
  
      cmap2 = {
          "colors": "blues",
          "min_value": 2,
          "max_value": 3,
          "reverse": True,
      }
      kwargs = {"palettes": [cmap2]}
      with mock.patch("trollimage.colormap.blues", ret_map):
          _ = mcp(kwargs)
      ret_map.reverse.assert_called_once()
      ret_map.set_range.assert_called_with(2, 3)
      create_colormap_mock.reset_mock()
      ret_map.reset_mock()
  
      kwargs = {"palettes": [cmap1, cmap2]}
      with mock.patch("trollimage.colormap.blues", ret_map):
          _ = mcp(kwargs)
      ret_map.__add__.assert_called_once()
  
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 11 for calling the TestEnhancementStretch obj's underlying member method code with example usage: obj.test_merge_colormaps() without return types