code: def test_categorical_add_categories(pd_str_cat, inplace):
      pd_sr = pd.Series(pd_str_cat.copy())
      cd_sr = cudf.Series(pd_str_cat.copy())
  
      assert_eq(pd_sr, cd_sr)
  
      assert str(pd_sr) == str(cd_sr)
  
      with _hide_deprecated_pandas_categorical_inplace_warnings(
          "add_categories"
      ):
          pd_sr_1 = pd_sr.cat.add_categories(["d"], inplace=inplace)
  
      if inplace:
          with pytest.warns(FutureWarning):
              cd_sr_1 = cd_sr.cat.add_categories(["d"], inplace=inplace)
          pd_sr_1 = pd_sr
          cd_sr_1 = cd_sr
      else:
          cd_sr_1 = cd_sr.cat.add_categories(["d"], inplace=inplace)
  
      assert "d" in pd_sr_1.cat.categories.to_list()
      assert "d" in cd_sr_1.cat.categories.to_pandas().to_list()
  
      assert_eq(pd_sr_1, cd_sr_1)
  
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 22 for calling a global function with example usage: test_categorical_add_categories(pd_str_cat, inplace) without return types