code: def test_index_expand_flatten_levels(df_expand):
      """Test output if `index_expand`"""
      actual = (
          df_expand.pivot(
              index="id", columns="year", values="percentage"
          )
          .reindex(pd.Categorical([1, 2, 3], ordered=True))
          .rename_axis(columns=None)
          .reset_index()
      )
      expected = df_expand.pivot_wider(
          "id", "year", "percentage", index_expand=True
      )
      assert_frame_equal(actual, expected)
  
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
label_desc: Use image node_id 34 for calling a global function with example usage: test_index_expand_flatten_levels(df_expand) without return types