code: def test_as_coordinate_map():
      ijk = CoordinateSystem("ijk")
      xyz = CoordinateSystem("xyz")
  
      A = np.random.standard_normal((4, 4))
  
      # bottom row of A is not [0,0,0,1]
      pytest.raises(ValueError, AffineTransform, ijk, xyz, A)
  
      A[-1] = [0, 0, 0, 1]
  
      aff = AffineTransform(ijk, xyz, A)
      _cmapA = _as_coordinate_map(aff)
      assert isinstance(_cmapA, CoordinateMap)
      assert _cmapA.inverse_function is not None
  
      # a non-invertible one
  
      B = A[1:]
      xy = CoordinateSystem("xy")
      affB = AffineTransform(ijk, xy, B)
      _cmapB = _as_coordinate_map(affB)
  
      assert isinstance(_cmapB, CoordinateMap)
      assert _cmapB.inverse_function is None
  
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 30 for calling a global function with example usage: test_as_coordinate_map() without return types