code: def test_numeric_series_replace_dtype(series_dtype, replacement):
      psr = pd.Series([0, 1, 2, 3, 4, 5], dtype=series_dtype)
      sr = cudf.from_pandas(psr)
  
      if sr.dtype.kind in "ui":
          can_replace = np.array([replacement])[
              0
          ].is_integer() and np.can_cast(int(replacement), sr.dtype)
      else:
          can_replace = np.can_cast(replacement, sr.dtype)
  
      # Both Scalar
      if not can_replace:
          with pytest.raises(TypeError):
              sr.replace(1, replacement)
      else:
          expect = psr.replace(1, replacement).astype(psr.dtype)
          got = sr.replace(1, replacement)
          assert_eq(expect, got)
  
      # to_replace is a list, replacement is a scalar
      if not can_replace:
          with pytest.raises(TypeError):
              sr.replace([2, 3], replacement)
      else:
          expect = psr.replace([2, 3], replacement).astype(psr.dtype)
          got = sr.replace([2, 3], replacement)
          assert_eq(expect, got)
  
      # If to_replace is a scalar and replacement is a list
      with pytest.raises(TypeError):
          sr.replace(0, [replacement, 2])
  
      # Both list of unequal length
      with pytest.raises(ValueError):
          sr.replace([0, 1], [replacement])
  
      # Both lists of equal length
      if (
          np.dtype(type(replacement)).kind == "f"
          and sr.dtype.kind in {"i", "u"}
      ) or (not can_replace):
          with pytest.raises(TypeError):
              sr.replace([2, 3], [replacement, replacement])
      else:
          expect = psr.replace(
              [2, 3], [replacement, replacement]
          ).astype(psr.dtype)
          got = sr.replace([2, 3], [replacement, replacement])
          assert_eq(expect, got)
  
imports: import re
  from decimal import Decimal
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_134, PANDAS_GE_150
  from cudf.core.dtypes import Decimal32Dtype, Decimal64Dtype, Decimal128Dtype
  from cudf.testing._utils import INTEGER_TYPES, NUMERIC_TYPES, assert_eq, assert_exceptions_equal
label_desc: Use image node_id 21 for calling a global function with example usage: test_numeric_series_replace_dtype(series_dtype, replacement) without return types