code: def test_dtypes():
      # invalid dtypes
      dtypes = np.sctypes["others"]
      dtypes.remove(object)
      for dt in dtypes:
          pytest.raises(ValueError, CoordinateSystem, "ijk", "test", dt)
      # compound dtype
      dtype = np.dtype([("field1", "<f8"), ("field2", "<i4")])
      pytest.raises(ValueError, CoordinateSystem, "ijk", "test", dtype)
      # valid dtypes
      dtypes = (
          np.sctypes["int"]
          + np.sctypes["float"]
          + np.sctypes["complex"]
          + [object]
      )
      for dt in dtypes:
          cs = CoordinateSystem("ij", coord_dtype=dt)
          assert cs.coord_dtype == dt
          cs_dt = [(f, dt) for f in "ij"]
          assert cs.dtype == np.dtype(cs_dt)
          # Check product too
          cs2 = CoordinateSystem("xy", coord_dtype=dt)
          assert product(cs, cs2) == CoordinateSystem(
              "ijxy", name="product", coord_dtype=dt
          )
      # verify assignment fails
      pytest.raises(
          AttributeError, setattr, cs, "dtype", np.dtype(cs_dt)
      )
      pytest.raises(
          AttributeError, setattr, cs, "coord_dtype", np.float64
      )
  
imports: from types import SimpleNamespace
  import numpy
  import pytest
  from ..coordinate_system import CoordinateSystem, CoordinateSystemError, CoordSysMaker, CoordSysMakerError, is_coordsys, is_coordsys_maker, product, safe_dtype
label_desc: Use image node_id 6 for calling a global function with example usage: test_dtypes() without return types