code: def test_agg_dict_renaming_deprecation():
      # 15931
      df = DataFrame(
          {"A": [1, 1, 1, 2, 2], "B": range(5), "C": range(5)}
      )
  
      msg = r"nested renamer is not supported"
      with pytest.raises(SpecificationError, match=msg):
          df.groupby("A").agg(
              {
                  "B": {"foo": ["sum", "max"]},
                  "C": {"bar": ["count", "min"]},
              }
          )
  
      msg = r"Column\(s\) \['ma'\] do not exist"
      with pytest.raises(KeyError, match=msg):
          df.groupby("A")[["B", "C"]].agg({"ma": "max"})
  
      msg = r"nested renamer is not supported"
      with pytest.raises(SpecificationError, match=msg):
          df.groupby("A").B.agg({"foo": "count"})
  
imports: import datetime
  from functools import partial
  import numpy
  import pytest
  from pandas.errors import SpecificationError
  import pandas
  from pandas import DataFrame, Index, MultiIndex, PeriodIndex, Series, date_range, period_range
  import pandas._testing
  from pandas.io.formats.printing import pprint_thing
label_desc: Use image node_id 8 for calling a global function with example usage: test_agg_dict_renaming_deprecation() without return types