code: def test_factorize_code_pandas_compatibility(pandas_compatibility):
      psr = pd.Series([1, 2, 3, 4, 5])
      gsr = cudf.from_pandas(psr)
  
      expect = pd.factorize(psr)
      with cudf.option_context(
          "mode.pandas_compatible", pandas_compatibility
      ):
          got = cudf.factorize(gsr)
      assert_eq(got[0], expect[0])
      assert_eq(got[1], expect[1])
      if pandas_compatibility:
          assert got[0].dtype == expect[0].dtype
      else:
          assert got[0].dtype == cudf.dtype("int8")
  
file_path: cudf/python/cudf/cudf/tests/test_factorize.py
imports: import cupy
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf import DataFrame, Index
  from cudf.testing._utils import assert_eq
label_desc: Use image node_id 7 for calling a global function with example usage: test_factorize_code_pandas_compatibility(pandas_compatibility) without return types