code: def test_categorical_allow_nan():
      gs = cudf.Series(
          [1, 2, np.nan, 10, np.nan, None], nan_as_null=False
      )
      gs = gs.astype("category")
      expected_codes = cudf.Series([0, 1, 3, 2, 3, None], dtype="uint8")
      assert_eq(expected_codes, gs.cat.codes)
  
      expected_categories = cudf.Index(
          [1.0, 2.0, 10.0, np.nan], dtype="float64"
      )
      assert_eq(expected_categories, gs.cat.categories)
  
      actual_ps = gs.to_pandas()
      expected_ps = pd.Series(
          [1.0, 2.0, np.nan, 10.0, np.nan, np.nan], dtype="category"
      )
      assert_eq(actual_ps, expected_ps)
  
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 34 for calling a global function with example usage: test_categorical_allow_nan() without return types