code: def test_size_sort(sort, by):
      df = DataFrame(
          np.random.default_rng(2).choice(20, (1000, 3)),
          columns=list("ABC"),
      )
      left = df.groupby(by=by, sort=sort).size()
      right = df.groupby(by=by, sort=sort)["C"].apply(
          lambda a: a.shape[0]
      )
      tm.assert_series_equal(left, right, check_names=False)
  
file_path: pandas/pandas/tests/groupby/methods/test_size.py
imports: import numpy
  import pytest
  import pandas.util._test_decorators
  from pandas.core.dtypes.common import is_integer_dtype
  from pandas import DataFrame, Index, PeriodIndex, Series
  import pandas._testing
label_desc: Use image node_id 3 for calling a global function with example usage: test_size_sort(sort, by) without return types