code: def test_rankWithGroupBy():
      train, groupCols, sortCols = generate_trainingFrame()
      (
          answerFrame,
          finalDir,
          finalSorts,
          sortCols,
          sortDirs,
          newColName,
      ) = generate_answerFrame(
          train, groupCols, sortCols
      )  # the rank_within_group result should return this
      rankedFrame = train.rank_within_group_by(
          groupCols, sortCols, sortDirs, newColName
      )
      rankedFrame.summary()
      pyunit_utils.compare_frames_local_onecolumn_NA(
          answerFrame[newColName],
          rankedFrame[newColName],
          1,
          tol=1e-10,
          oneLessRow=True,
      )
  
imports: import sys, os
  import h2o
  from tests import pyunit_utils
  from random import randint
  import random
label_desc: Use image node_id 1 for calling a global function with example usage: test_rankWithGroupBy() without return types