code: def test_categorical_set_categories_categoricals(
      data, new_categories
  ):
      pd_data = data.copy().astype("category")
      gd_data = cudf.from_pandas(pd_data)
  
      expected = pd_data.cat.set_categories(
          new_categories=new_categories
      )
      with _hide_cudf_safe_casting_warning():
          actual = gd_data.cat.set_categories(
              new_categories=new_categories
          )
  
      assert_eq(expected, actual)
  
      expected = pd_data.cat.set_categories(
          new_categories=pd.Series(new_categories, dtype="category")
      )
      with _hide_cudf_safe_casting_warning():
          actual = gd_data.cat.set_categories(
              new_categories=cudf.Series(
                  new_categories, dtype="category"
              )
          )
  
      assert_eq(expected, actual)
  
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 26 for calling a global function with example usage: test_categorical_set_categories_categoricals(data, new_categories) without return types