code: def test_rename(setup):
      rs = np.random.RandomState(0)
      raw = pd.DataFrame(rs.rand(10, 4), columns=["A", "B", "C", "D"])
      df = md.DataFrame(raw, chunk_size=3)
  
      with pytest.warns(Warning):
          df.rename(str, errors="raise")
  
      with pytest.raises(NotImplementedError):
          df.rename({"A": "a", "B": "b"}, axis=1, copy=False)
  
      r = df.rename(str)
      pd.testing.assert_frame_equal(
          r.execute().fetch(), raw.rename(str)
      )
  
      r = df.rename({"A": "a", "B": "b"}, axis=1)
      pd.testing.assert_frame_equal(
          r.execute().fetch(), raw.rename({"A": "a", "B": "b"}, axis=1)
      )
  
      df.rename({"A": "a", "B": "b"}, axis=1, inplace=True)
      pd.testing.assert_frame_equal(
          df.execute().fetch(), raw.rename({"A": "a", "B": "b"}, axis=1)
      )
  
      raw = pd.DataFrame(
          rs.rand(10, 4),
          columns=pd.MultiIndex.from_tuples(
              (("A", "C"), ("A", "D"), ("B", "E"), ("B", "F"))
          ),
      )
      df = md.DataFrame(raw, chunk_size=3)
  
      r = df.rename({"C": "a", "D": "b"}, level=1, axis=1)
      pd.testing.assert_frame_equal(
          r.execute().fetch(),
          raw.rename({"C": "a", "D": "b"}, level=1, axis=1),
      )
  
      raw = pd.Series(rs.rand(10), name="series")
      series = md.Series(raw, chunk_size=3)
  
      r = series.rename("new_series")
      pd.testing.assert_series_equal(
          r.execute().fetch(), raw.rename("new_series")
      )
  
      r = series.rename(lambda x: 2**x)
      pd.testing.assert_series_equal(
          r.execute().fetch(), raw.rename(lambda x: 2**x)
      )
  
      with pytest.raises(TypeError):
          series.name = {1: 10, 2: 20}
  
      series.name = "new_series"
      pd.testing.assert_series_equal(
          series.execute().fetch(), raw.rename("new_series")
      )
  
      raw = pd.MultiIndex.from_frame(
          pd.DataFrame(rs.rand(10, 2), columns=["A", "B"])
      )
      idx = md.Index(raw)
  
      r = idx.rename(["C", "D"])
      pd.testing.assert_index_equal(
          r.execute().fetch(), raw.rename(["C", "D"])
      )
  
      r = idx.set_names("C", level=0)
      pd.testing.assert_index_equal(
          r.execute().fetch(), raw.set_names("C", level=0)
      )
  
imports: import os
  import tempfile
  import mars
  import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....utils import pd_release_version
  from ...datasource.read_csv import DataFrameReadCSV
  from ...datasource.read_sql import DataFrameReadSQL
  from ...datasource.read_parquet import DataFrameReadParquet
label_desc: Use image node_id 15 for calling a global function with example usage: test_rename(setup) without return types