code: def test_categorical_masking():
      """
      Test common operation for getting a all rows that matches a certain
      category.
      """
      cat = pd.Categorical(
          ["a", "a", "b", "c", "a"], categories=["a", "b", "c"]
      )
      pdsr = pd.Series(cat)
      sr = cudf.Series(cat)
  
      # check scalar comparison
      expect_matches = pdsr == "a"
      got_matches = sr == "a"
  
      np.testing.assert_array_equal(
          expect_matches.values, got_matches.to_numpy()
      )
  
      # mask series
      expect_masked = pdsr[expect_matches]
      got_masked = sr[got_matches]
  
      assert len(expect_masked) == len(got_masked)
      assert got_masked.null_count == 0
      assert_eq(got_masked, expect_masked)
  
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 10 for calling a global function with example usage: test_categorical_masking() without return types