code: def test_renamed():
      # Renaming domain and range
      A = AffineTransform.from_params("ijk", "xyz", np.identity(4))
      ijk = CoordinateSystem("ijk")
      xyz = CoordinateSystem("xyz")
      C = CoordinateMap(ijk, xyz, np.log)
      for B in [A, C]:
          B_re = B.renamed_domain({"i": "foo"})
          assert B_re.function_domain.coord_names == ("foo", "j", "k")
          B_re = B.renamed_domain({"i": "foo", "j": "bar"})
          assert B_re.function_domain.coord_names == ("foo", "bar", "k")
          B_re = B.renamed_range({"y": "foo"})
          assert B_re.function_range.coord_names == ("x", "foo", "z")
          B_re = B.renamed_range({0: "foo", 1: "bar"})
          assert B_re.function_range.coord_names == ("foo", "bar", "z")
          B_re = B.renamed_domain({0: "foo", 1: "bar"})
          assert B_re.function_domain.coord_names == ("foo", "bar", "k")
          B_re = B.renamed_range({"y": "foo", "x": "bar"})
          assert B_re.function_range.coord_names == ("bar", "foo", "z")
          pytest.raises(ValueError, B.renamed_range, {"foo": "y"})
          pytest.raises(ValueError, B.renamed_domain, {"foo": "y"})
  
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 3 for calling a global function with example usage: test_renamed() without return types