code: def test_groupby_head_tail(op, n, expected_rows, columns, as_index):
      df = DataFrame([[1, 2], [1, 4], [5, 6]], columns=["A", "B"])
      g = df.groupby("A", as_index=as_index)
      expected = df.iloc[expected_rows]
      if columns is not None:
          g = g[columns]
          expected = expected[columns]
      result = getattr(g, op)(n)
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, isna
  import pandas._testing
label_desc: Use image node_id 21 for calling a global function with example usage: test_groupby_head_tail(op, n, expected_rows, columns, as_index) without return types