code: def test_size_axis_1(df, axis_1, by, sort, dropna):
      # GH#45715
      counts = {
          key: sum(value == key for value in by)
          for key in dict.fromkeys(by)
      }
      if dropna:
          counts = {
              key: value
              for key, value in counts.items()
              if key is not None
          }
      expected = Series(counts, dtype="int64")
      if sort:
          expected = expected.sort_index()
      if is_integer_dtype(expected.index.dtype) and not any(
          x is None for x in by
      ):
          expected.index = expected.index.astype(int)
  
      msg = "DataFrame.groupby with axis=1 is deprecated"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          grouped = df.groupby(
              by=by, axis=axis_1, sort=sort, dropna=dropna
          )
      result = grouped.size()
      tm.assert_series_equal(result, expected)
  
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 2 for calling a global function with example usage: test_size_axis_1(df, axis_1, by, sort, dropna) without return types