code: def test_categorical_assignment(data, cat_dtype):
      pd_df = pd.DataFrame()
      pd_df["a"] = np.ones(len(data))
      cd_df = cudf.from_pandas(pd_df)
  
      pd_cat_series = pd.Series(data, dtype=cat_dtype)
      # assign categorical series
      pd_df.assign(cat_col=pd_cat_series)
      cd_df.assign(cat_col=pd_cat_series)
      assert_eq(pd_df, cd_df)
  
      # assign categorical array
      # needed for dask_cudf support for including file name
      # as a categorical column
      # see issue: https://github.com/rapidsai/cudf/issues/2269
      pd_df = pd.DataFrame()
      pd_df["a"] = np.ones(len(data))
      cd_df = cudf.from_pandas(pd_df)
  
      pd_categorical = pd.Categorical(data, dtype=cat_dtype)
      pd_df.assign(cat_col=pd_categorical)
      cd_df.assign(cat_col=pd_categorical)
      assert_eq(pd_df, cd_df)
  
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 33 for calling a global function with example usage: test_categorical_assignment(data, cat_dtype) without return types