code: def test_xyz_order(vars):
      # Getting xyz ordering from a coordinate system
      assert_array_equal(xyz_order(vars["r_cs_r3"]), [0, 1, 2])
      assert_array_equal(xyz_order(vars["r_cs_r4"]), [0, 1, 2, 3])
      r_cs = CS(("mni-x=L->R", "mni-y=P->A", "mni-q"), "mni")
      pytest.raises(AxesError, xyz_order, r_cs)
      r_cs = CS(("t", "mni-x=L->R", "mni-z=I->S", "mni-y=P->A"), "mni")
      assert_array_equal(xyz_order(r_cs), [1, 3, 2, 0])
      # Can pass in own validator
      my_valtor = {"ditch": "x", "leading": "y", "blind": "z"}
      r_cs = CS(("blind", "leading", "ditch"), "fall")
      pytest.raises(AxesError, xyz_order, r_cs)
      assert_array_equal(xyz_order(r_cs, my_valtor), [2, 1, 0])
  
file_path: nipy/nipy/core/reference/tests/test_spaces.py
imports: import numpy
  import pytest
  from nibabel.affines import from_matvec
  from numpy.testing import assert_array_equal
  from ...image.image import Image
  from ..coordinate_map import AffineTransform, CoordinateMap
  from ..coordinate_system import CoordinateSystem
  from ..coordinate_system import CoordSysMakerError
  from ..spaces import AffineError, AxesError, SpaceError, SpaceTypeError, XYZSpace, get_world_cs, is_xyz_affable, is_xyz_space, known_space, known_spaces, mni_csm, mni_space, vox2aligned, vox2mni, vox2scanner, vox2talairach, vox2unknown, xyz_affine, xyz_order
label_desc: Use image node_id 9 for calling a global function with example usage: test_xyz_order(vars) without return types