code: def test_append_io_dim():
      aff = np.diag([1, 2, 3, 1])
      in_dims = tuple("ijk")
      out_dims = tuple("xyz")
      cm = AffineTransform.from_params(in_dims, out_dims, aff)
      cm2 = append_io_dim(cm, "l", "t")
      assert_array_equal(cm2.affine, np.diag([1, 2, 3, 1, 1]))
      assert cm2.function_range.coord_names == out_dims + ("t",)
      assert cm2.function_domain.coord_names == in_dims + ("l",)
      cm2 = append_io_dim(cm, "l", "t", 9, 5)
      a2 = np.diag([1, 2, 3, 5, 1])
      a2[3, 4] = 9
      assert_array_equal(cm2.affine, a2)
      assert cm2.function_range.coord_names == out_dims + ("t",)
      assert cm2.function_domain.coord_names == in_dims + ("l",)
      # non square case
      aff = np.array([[2, 0, 0], [0, 3, 0], [0, 0, 1], [0, 0, 1]])
      cm = AffineTransform.from_params("ij", "xyz", aff)
      cm2 = append_io_dim(cm, "q", "t", 9, 5)
      a2 = np.array(
          [
              [2, 0, 0, 0],
              [0, 3, 0, 0],
              [0, 0, 0, 1],
              [0, 0, 5, 9],
              [0, 0, 0, 1],
          ]
      )
      assert_array_equal(cm2.affine, a2)
      assert cm2.function_range.coord_names == tuple("xyzt")
      assert cm2.function_domain.coord_names == tuple("ijq")
  
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 32 for calling a global function with example usage: test_append_io_dim() without return types