code: def test_compose(eg_cmaps):
      value = np.array([[1.0, 2.0, 3.0]]).T
      aa = compose(eg_cmaps.a, eg_cmaps.a)
      assert aa.inverse() is None
      assert_almost_equal(aa(value), 4 * value)
      ab = compose(eg_cmaps.a, eg_cmaps.b)
      assert ab.inverse() is None
      assert_almost_equal(ab(value), 4 * value)
      ac = compose(eg_cmaps.a, eg_cmaps.c)
      assert ac.inverse() is None
      assert_almost_equal(ac(value), value)
      _ = compose(eg_cmaps.b, eg_cmaps.b)
      #    assert bb.inverse() is not None
      aff1 = np.diag([1, 2, 3, 1])
      affine1 = AffineTransform.from_params("ijk", "xyz", aff1)
      aff2 = np.diag([4, 5, 6, 1])
      affine2 = AffineTransform.from_params("xyz", "abc", aff2)
      # compose mapping from 'ijk' to 'abc'
      compcm = compose(affine2, affine1)
      assert compcm.function_domain.coord_names == ("i", "j", "k")
      assert compcm.function_range.coord_names == ("a", "b", "c")
      assert_almost_equal(compcm.affine, np.dot(aff2, aff1))
      # check invalid coordinate mappings
      pytest.raises(ValueError, compose, affine1, affine2)
      pytest.raises(ValueError, compose, affine1, "foo")
      cm1 = CoordinateMap(
          CoordinateSystem("ijk"), CoordinateSystem("xyz"), np.log
      )
      cm2 = CoordinateMap(
          CoordinateSystem("xyz"), CoordinateSystem("abc"), np.exp
      )
      pytest.raises(ValueError, compose, cm1, cm2)
  
imports: from copy import copy
  from types import SimpleNamespace
  import numpy
  from ..coordinate_map import AffineTransform, AxisError, CoordinateMap, CoordMapMaker, CoordMapMakerError, _as_coordinate_map, _fix0, append_io_dim, axmap, compose, drop_io_dim, equivalent, input_axis_index, io_axis_indices, orth_axes, product, shifted_domain_origin, shifted_range_origin
  from ..coordinate_system import CoordinateSystem, CoordinateSystemError, CoordSysMaker
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
label_desc: Use image node_id 6 for calling a global function with example usage: test_compose(eg_cmaps) without return types