code: def test_ufunc_index(request, ufunc):
      # Note: This test assumes that all ufuncs are unary or binary.
      fname = ufunc.__name__
      request.applymarker(
          pytest.mark.xfail(
              condition=(
                  fname in {"bitwise_and", "bitwise_or", "bitwise_xor"}
                  and not PANDAS_GE_150
              ),
              reason="https://github.com/pandas-dev/pandas/issues/46769",
          )
      )
      request.applymarker(
          pytest.mark.xfail(
              condition=not hasattr(cp, fname),
              reason=f"cupy has no support for '{fname}'",
          )
      )
  
      N = 100
      # Avoid zeros in either array to skip division by 0 errors. Also limit the
      # scale to avoid issues with overflow, etc. We use ints because some
      # operations (like bitwise ops) are not defined for floats.
      pandas_args = args = [
          cudf.Index(
              cp.random.randint(low=1, high=10, size=N),
          )
          for _ in range(ufunc.nin)
      ]
  
      got = ufunc(*args)
  
      with _hide_ufunc_warnings(ufunc):
          expect = ufunc(*(arg.to_pandas() for arg in pandas_args))
  
      if ufunc.nout > 1:
          for g, e in zip(got, expect):
              assert_eq(g, e, check_exact=False)
      else:
          assert_eq(got, expect, check_exact=False)
  
file_path: cudf/python/cudf/cudf/tests/test_array_ufunc.py
imports: import operator
  import warnings
  from contextlib import contextmanager
  from functools import reduce
  import cupy
  import numpy
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_150
  from cudf.testing._utils import assert_eq, set_random_null_mask_inplace
label_desc: Use image node_id 2 for calling a global function with example usage: test_ufunc_index(request, ufunc) without return types