code: def _test_top_with_groupby(self, dtype, seed):
      permute = partial(permute_rows, seed)
      permuted_array = compose(
          permute, partial(array, dtype=int64_dtype)
      )
  
      shape = (8, 8)
  
      # Shuffle the input rows to verify that we correctly pick out the top
      # values independently of order.
      factor_data = permute(arange(0, 64, dtype=dtype).reshape(shape))
  
      classifier_data = permuted_array(
          [
              [0, 0, 1, 1, 2, 2, 0, 0],
              [0, 0, 1, 1, 2, 2, 0, 0],
              [0, 1, 2, 3, 0, 1, 2, 3],
              [0, 1, 2, 3, 0, 1, 2, 3],
              [0, 0, 0, 0, 1, 1, 1, 1],
              [0, 0, 0, 0, 1, 1, 1, 1],
              [0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0],
          ]
      )
      f = self.f
      c = self.c
      self.check_terms(
          terms={
              "1": f.top(1, groupby=c),
              "2": f.top(2, groupby=c),
              "3": f.top(3, groupby=c),
          },
          initial_workspace={
              f: factor_data,
              c: classifier_data,
          },
          expected={
              # Should be the rightmost location of each entry in
              # classifier_data.
              "1": permuted_array(
                  [
                      [0, 0, 0, 1, 0, 1, 0, 1],
                      [0, 0, 0, 1, 0, 1, 0, 1],
                      [0, 0, 0, 0, 1, 1, 1, 1],
                      [0, 0, 0, 0, 1, 1, 1, 1],
                      [0, 0, 0, 1, 0, 0, 0, 1],
                      [0, 0, 0, 1, 0, 0, 0, 1],
                      [0, 0, 0, 0, 0, 0, 0, 1],
                      [0, 0, 0, 0, 0, 0, 0, 1],
                  ],
                  dtype=bool,
              ),
              # Should be the first and second-rightmost location of each
              # entry in classifier_data.
              "2": permuted_array(
                  [
                      [0, 0, 1, 1, 1, 1, 1, 1],
                      [0, 0, 1, 1, 1, 1, 1, 1],
                      [1, 1, 1, 1, 1, 1, 1, 1],
                      [1, 1, 1, 1, 1, 1, 1, 1],
                      [0, 0, 1, 1, 0, 0, 1, 1],
                      [0, 0, 1, 1, 0, 0, 1, 1],
                      [0, 0, 0, 0, 0, 0, 1, 1],
                      [0, 0, 0, 0, 0, 0, 1, 1],
                  ],
                  dtype=bool,
              ),
              # Should be the first, second, and third-rightmost location of
              # each entry in classifier_data.
              "3": permuted_array(
                  [
                      [0, 1, 1, 1, 1, 1, 1, 1],
                      [0, 1, 1, 1, 1, 1, 1, 1],
                      [1, 1, 1, 1, 1, 1, 1, 1],
                      [1, 1, 1, 1, 1, 1, 1, 1],
                      [0, 1, 1, 1, 0, 1, 1, 1],
                      [0, 1, 1, 1, 0, 1, 1, 1],
                      [0, 0, 0, 0, 0, 1, 1, 1],
                      [0, 0, 0, 0, 0, 1, 1, 1],
                  ],
                  dtype=bool,
              ),
          },
          mask=self.build_mask(self.ones_mask(shape=shape)),
      )
  
imports: from functools import partial
  from itertools import product
  from operator import and_
  from toolz import compose
  from numpy import arange, argsort, array, eye, float64, full, inf, isfinite, nan, nanpercentile, ones, ones_like, putmask, rot90, sum
  from numpy.random import randn, seed
  import pandas
  from catalyst.errors import BadPercentileBounds
  from catalyst.pipeline import Filter, Factor, Pipeline
  from catalyst.pipeline.classifiers import Classifier
  from catalyst.pipeline.factors import CustomFactor
  from catalyst.pipeline.filters import All, Any, AtLeastN, StaticAssets, StaticSids
  from catalyst.testing import parameter_space, permute_rows, CatalystTestCase
  from catalyst.testing.fixtures import WithSeededRandomPipelineEngine
  from catalyst.testing.predicates import assert_equal
  from catalyst.utils.numpy_utils import float64_dtype, int64_dtype
  from .base import BasePipelineTestCase, with_default_shape
label_desc: Use image node_id 15 for calling the FilterTestCase obj's underlying member method code with example usage: obj._test_top_with_groupby(dtype, seed) without return types