code: def test_categorical_set_categories_preserves_order():
      series = pd.Series([1, 0, 0, 0, 2]).astype("category")
      # reassigning categories should preserve element ordering
      assert_eq(
          series.cat.set_categories([1, 2]),
          cudf.Series(series).cat.set_categories([1, 2]),
      )
  
imports: import operator
  import string
  import warnings
  from contextlib import contextmanager
  from textwrap import dedent
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_134
  from cudf.testing._utils import NUMERIC_TYPES, assert_eq, assert_exceptions_equal, expect_warning_if
label_desc: Use image node_id 18 for calling a global function with example usage: test_categorical_set_categories_preserves_order() without return types