code: def test_partition_index(method, exp):
      # https://github.com/pandas-dev/pandas/issues/23558
  
      values = Index(["a_b_c", "c_d_e", "f_g_h", np.nan, None])
  
      result = getattr(values.str, method)("_", expand=False)
      exp = Index(np.array(exp, dtype=object), dtype=object)
      tm.assert_index_equal(result, exp)
      assert result.nlevels == 1
  
imports: from datetime import datetime
  import re
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, _testing
  from pandas.tests.strings import _convert_na_value, object_pyarrow_numpy
label_desc: Use image node_id 36 for calling a global function with example usage: test_partition_index(method, exp) without return types