code: def test_replace():
      # dataframe cases
      df_raw = pd.DataFrame(
          -1, index=range(0, 20), columns=list("ABCDEFGHIJ")
      )
      for _ in range(30):
          df_raw.iloc[
              random.randint(0, 19), random.randint(0, 9)
          ] = random.randint(0, 99)
      for rowid in range(random.randint(1, 5)):
          row = random.randint(0, 19)
          for idx in range(0, 10):
              df_raw.iloc[row, idx] = random.randint(0, 99)
  
      # not supporting fill with limit
      df = md.DataFrame(df_raw, chunk_size=4)
      with pytest.raises(NotImplementedError):
          df.replace(-1, method="ffill", limit=5)
  
      r = tile(df.replace(-1, method="ffill"))
      assert len(r.chunks) == 15
      assert r.chunks[0].shape == (4, 4)
      assert r.chunks[0].op.stage == OperandStage.combine
      assert r.chunks[0].op.method == "ffill"
      assert r.chunks[0].op.limit is None
      assert r.chunks[-1].inputs[-1].shape == (1, 2)
      assert r.chunks[-1].inputs[-1].op.stage == OperandStage.map
      assert r.chunks[-1].inputs[-1].op.method == "ffill"
      assert r.chunks[-1].inputs[-1].op.limit is None
  
      r = tile(df.replace(-1, 99))
      assert len(r.chunks) == 15
      assert r.chunks[0].shape == (4, 4)
      assert r.chunks[0].op.stage is None
      assert r.chunks[0].op.limit is None
  
      # series cases
      series_raw = pd.Series(-1, index=range(20))
      for _ in range(10):
          series_raw.iloc[random.randint(0, 19)] = random.randint(0, 99)
      series = md.Series(series_raw, chunk_size=4)
  
      r = tile(series.replace(-1, method="ffill"))
      assert len(r.chunks) == 5
      assert r.chunks[0].shape == (4,)
      assert r.chunks[0].op.stage == OperandStage.combine
      assert r.chunks[0].op.method == "ffill"
      assert r.chunks[0].op.limit is None
      assert r.chunks[-1].inputs[-1].shape == (1,)
      assert r.chunks[-1].inputs[-1].op.stage == OperandStage.map
      assert r.chunks[-1].inputs[-1].op.method == "ffill"
      assert r.chunks[-1].inputs[-1].op.limit is None
  
      r = tile(series.replace(-1, 99))
      assert len(r.chunks) == 5
      assert r.chunks[0].shape == (4,)
      assert r.chunks[0].op.stage is None
      assert r.chunks[0].op.limit is None
  
file_path: mars/mars/dataframe/missing/tests/test_missing.py
imports: import random
  import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....core import tile
  from ....core.operand import OperandStage
  from ....utils import pd_release_version
  from ...core import MultiIndex
label_desc: Use image node_id 3 for calling a global function with example usage: test_replace() without return types