code: def test_sort_index():
      raw = pd.DataFrame(
          np.random.rand(10, 10),
          columns=np.random.rand(10),
          index=np.random.rand(10),
      )
      df = DataFrame(raw)
      sorted_df = sort_index(df)
  
      assert sorted_df.shape == raw.shape
      assert isinstance(sorted_df.op, DataFrameSortIndex)
  
      tiled = tile(sorted_df)
  
      assert len(tiled.chunks) == 1
      assert isinstance(tiled.chunks[0].op, DataFrameSortIndex)
  
      df = DataFrame(raw, chunk_size=6)
      sorted_df = sort_index(df)
  
      assert sorted_df.shape == raw.shape
      assert isinstance(sorted_df.op, DataFrameSortIndex)
  
      tiled = tile(sorted_df)
  
      assert len(tiled.chunks) == 2
      assert tiled.chunks[0].op.stage == OperandStage.reduce
  
      df = DataFrame(raw, chunk_size=3)
      sorted_df = sort_index(df)
  
      assert sorted_df.shape == raw.shape
      assert isinstance(sorted_df.op, DataFrameSortIndex)
  
      tiled = tile(sorted_df)
  
      assert len(tiled.chunks) == 3
      assert tiled.chunks[0].op.stage == OperandStage.reduce
      assert tiled.chunks[1].op.stage == OperandStage.reduce
      assert tiled.chunks[2].op.stage == OperandStage.reduce
  
      # support on axis 1
      df = DataFrame(raw, chunk_size=4)
      sorted_df = sort_index(df, axis=1)
  
      assert sorted_df.shape == raw.shape
      assert isinstance(sorted_df.op, DataFrameSortIndex)
  
      tiled = tile(sorted_df)
  
      assert (
          all(isinstance(c.op, DataFrameIndex) for c in tiled.chunks)
          is True
      )
  
file_path: mars/mars/dataframe/sort/tests/test_sort.py
imports: import numpy
  import pandas
  from ....core import tile
  from ....core.operand import OperandStage
  from ...indexing.getitem import DataFrameIndex
  from ...initializer import DataFrame
  from ..sort_index import sort_index, DataFrameSortIndex
  from ..sort_values import dataframe_sort_values, DataFrameSortValues
label_desc: Use image node_id 2 for calling a global function with example usage: test_sort_index() without return types