code: def test_categorical_series_repr_period(self):
      idx = period_range("2011-01-01 09:00", freq="h", periods=5)
      s = Series(Categorical(idx))
      exp = """0    2011-01-01 09:00
  1    2011-01-01 10:00
  2    2011-01-01 11:00
  3    2011-01-01 12:00
  4    2011-01-01 13:00
  dtype: category
  Categories (5, period[h]): [2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00,
                              2011-01-01 13:00]"""  # noqa: E501
  
      assert repr(s) == exp
  
      idx = period_range("2011-01", freq="M", periods=5)
      s = Series(Categorical(idx))
      exp = """0    2011-01
  1    2011-02
  2    2011-03
  3    2011-04
  4    2011-05
  dtype: category
  Categories (5, period[M]): [2011-01, 2011-02, 2011-03, 2011-04, 2011-05]"""
  
      assert repr(s) == exp
  
imports: from datetime import datetime, timedelta
  import numpy
  import pytest
  from pandas._config import using_pyarrow_string_dtype
  import pandas
  from pandas import Categorical, DataFrame, Index, Series, date_range, option_context, period_range, timedelta_range
  import pandas._testing
label_desc: Use image node_id 7 for calling the TestCategoricalRepr obj's underlying member method code with example usage: obj.test_categorical_series_repr_period() without return types