code: def test_sort():
      a = tensor(np.random.rand(10, 10), chunk_size=(5, 10))
  
      sa = sort(a)
      assert type(sa.op).__name__ == "TensorSort"
  
      sa = tile(sa)
  
      assert len(sa.chunks) == 2
      for c in sa.chunks:
          assert type(c.op).__name__ == "TensorSort"
          assert type(c.inputs[0].op).__name__ == "ArrayDataSource"
  
      a = tensor(np.random.rand(100), chunk_size=(10))
  
      sa = sort(a)
      assert type(sa.op).__name__ == "TensorSort"
  
      sa = tile(sa)
  
      for c in sa.chunks:
          assert type(c.op).__name__ == "PSRSShuffle"
          assert c.op.stage == OperandStage.reduce
          assert c.shape == (np.nan,)
  
      a = tensor(
          np.empty(
              (10, 10), dtype=[("id", np.int32), ("size", np.int64)]
          ),
          chunk_size=(10, 5),
      )
      sa = sort(a)
      assert sa.op.order == ["id", "size"]
  
      with pytest.raises(ValueError):
          sort(a, order=["unknown_field"])
  
      with pytest.raises(np.AxisError):
          sort(np.random.rand(100), axis=1)
  
      with pytest.raises(ValueError):
          sort(np.random.rand(100), kind="non_valid_kind")
  
      with pytest.raises(ValueError):
          sort(
              np.random.rand(100),
              parallel_kind="non_valid_parallel_kind",
          )
  
      with pytest.raises(TypeError):
          sort(np.random.rand(100), psrs_kinds="non_valid_psrs_kinds")
  
      with pytest.raises(ValueError):
          sort(np.random.rand(100), psrs_kinds=["quicksort"] * 2)
  
      with pytest.raises(ValueError):
          sort(np.random.rand(100), psrs_kinds=["non_valid_kind"] * 3)
  
      with pytest.raises(ValueError):
          sort(np.random.rand(100), psrs_kinds=[None, None, None])
  
      with pytest.raises(ValueError):
          sort(
              np.random.rand(100),
              psrs_kinds=["quicksort", "mergesort", None],
          )
  
imports: import numpy
  import pytest
  from ....core import tile
  from ....core.operand import OperandStage
  from ...datasource import ones, tensor, arange
  from ..None import transpose, broadcast_to, where, argwhere, array_split, split, squeeze, result_type, repeat, copyto, isin, moveaxis, TensorCopyTo, atleast_1d, atleast_2d, atleast_3d, ravel, searchsorted, unique, sort, partition, topk, to_gpu, to_cpu
label_desc: Use image node_id 22 for calling a global function with example usage: test_sort() without return types