code: def test_input_axis_index():
      # Test routine to map name to input axis
      cmap = AffineTransform("ijk", "xyz", np.eye(4))
      for i, in_name, out_name in zip(range(3), "ijk", "xyz"):
          assert input_axis_index(cmap, in_name) == i
          assert input_axis_index(cmap, out_name) == i
      flipped = [[0, 0, 1, 1], [0, 1, 0, 2], [1, 0, 0, 3], [0, 0, 0, 1]]
      cmap_f = AffineTransform("ijk", "xyz", flipped)
      for i, in_name, out_name in zip(range(3), "ijk", "zyx"):
          assert input_axis_index(cmap_f, in_name) == i
          assert input_axis_index(cmap_f, out_name) == i
      # Names can be same in input and output but they must match
      cmap_m = AffineTransform("ijk", "kji", flipped)
      for i, in_name, out_name in zip(range(3), "ijk", "ijk"):
          assert input_axis_index(cmap_m, in_name) == i
          assert input_axis_index(cmap_m, out_name) == i
      # If they don't match, AxisError
      cmap_b = AffineTransform("ijk", "xiz", np.eye(4))
      assert input_axis_index(cmap_m, "j") == 1
      pytest.raises(AxisError, input_axis_index, cmap_b, "i")
      # Name not found, AxisError
      pytest.raises(AxisError, input_axis_index, cmap_b, "q")
      # 0 leads to no match if fix0 turned off
      cmap_z = AffineTransform("ijk", "xyz", np.diag([2, 3, 0, 1]))
      assert input_axis_index(cmap_z, "z") == 2
      assert input_axis_index(cmap_z, "z", fix0=True) == 2
      pytest.raises(
          AxisError, input_axis_index, cmap_z, "z", fix0=False
      )
      # Other axes not affected in presence of 0
      assert input_axis_index(cmap_z, "y") == 1
  
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 37 for calling a global function with example usage: test_input_axis_index() without return types