code: def test_unknown_categories(self, series):
      a, da = series
      assert da.cat.known
      da = da.cat.as_unknown()
      assert not da.cat.known
  
      with pytest.raises(
          NotImplementedError, match="with unknown categories"
      ):
          da.cat.categories
      with pytest.raises(
          NotImplementedError, match="with unknown categories"
      ):
          da.cat.codes
      # Also AttributeError so glob searching in IPython such as `da.cat.*?` works
      with pytest.raises(
          AttributeError, match="with unknown categories"
      ):
          da.cat.categories
      with pytest.raises(
          AttributeError, match="with unknown categories"
      ):
          da.cat.codes
  
      db = da.cat.set_categories(["a", "b", "c"])
      assert db.cat.known
      tm.assert_index_equal(db.cat.categories, get_cat(a).categories)
      assert_array_index_eq(db.cat.codes, get_cat(a).codes)
  
      db = da.cat.as_known()
      assert db.cat.known
      res = db.compute()
      tm.assert_index_equal(db.cat.categories, get_cat(res).categories)
      assert_array_index_eq(db.cat.codes, get_cat(res).codes)
  
imports: from __future__ import annotations
  import contextlib
  import operator
  import warnings
  import numpy
  import pandas
  import pytest
  import dask
  import dask.dataframe
  from dask.dataframe import _compat
  from dask.dataframe._compat import PANDAS_GE_150, PANDAS_GE_200, PANDAS_GE_210, tm
  from dask.dataframe._pyarrow import to_pyarrow_string
  from dask.dataframe.core import _concat
  from dask.dataframe.utils import assert_eq, clear_known_categories, get_string_dtype, make_meta, pyarrow_strings_enabled
label_desc: Use image node_id 4 for calling the TestCategoricalAccessor obj's underlying member method code with example usage: obj.test_unknown_categories(series) without return types