code: def test_groupby(idx):
      groups = idx.groupby(np.array([1, 1, 1, 2, 2, 2]))
      labels = idx.tolist()
      exp = {1: labels[:3], 2: labels[3:]}
      tm.assert_dict_equal(groups, exp)
  
      # GH5620
      groups = idx.groupby(idx)
      exp = {key: [key] for key in idx}
      tm.assert_dict_equal(groups, exp)
  
file_path: pandas/pandas/tests/indexes/multi/test_analytics.py
imports: import numpy
  import pytest
  import pandas
  from pandas import Index, MultiIndex, date_range, period_range
  import pandas._testing
label_desc: Use image node_id 3 for calling a global function with example usage: test_groupby(idx) without return types