code: def test_replace_enum() -> None:
      dtype = pl.Enum(["a", "b", "c", "d"])
      s = pl.Series(["a", "b", "c"], dtype=dtype)
      old = ["a", "b"]
      new = pl.Series(["c", "d"], dtype=dtype)
  
      result = s.replace(old, new)
  
      expected = pl.Series(["c", "d", "c"], dtype=dtype)
      assert_series_equal(result, expected)
  
imports: from __future__ import annotations
  import contextlib
  from typing import Any
  import pytest
  import polars
  from polars.exceptions import CategoricalRemappingWarning
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 7 for calling a global function with example usage: test_replace_enum() without return types