code: def test_categorical_nan_handling(self):
      # NaNs are represented as -1 in labels
      s = Series(Categorical(["a", "b", np.nan, "a"]))
      tm.assert_index_equal(s.cat.categories, Index(["a", "b"]))
      tm.assert_numpy_array_equal(
          s.values.codes, np.array([0, 1, -1, 0], dtype=np.int8)
      )
  
file_path: pandas/pandas/tests/series/test_missing.py
imports: from datetime import timedelta
  import numpy
  import pytest
  from pandas._libs import iNaT
  import pandas
  from pandas import Categorical, Index, NaT, Series, isna
  import pandas._testing
label_desc: Use image node_id 1 for calling the TestSeriesMissingData obj's underlying member method code with example usage: obj.test_categorical_nan_handling() without return types