code: def test_group_on_two():
      groups, workspace = make_image_sets(
          (
              ("Plate", ("P-12345", "P-23456")),
              ("Well", ("A01", "A02", "A03")),
              ("Site", ("1", "2", "3", "4")),
          ),
          (
              (
                  "DNA",
                  "Wavelength",
                  "1",
                  cellprofiler_core.pipeline.ImageSetChannelDescriptor.CT_GRAYSCALE,
              ),
              (
                  "GFP",
                  "Wavelength",
                  "1",
                  cellprofiler_core.pipeline.ImageSetChannelDescriptor.CT_GRAYSCALE,
              ),
          ),
      )
      groups.wants_groups.value = True
      groups.grouping_metadata[0].metadata_choice.value = "Plate"
      groups.add_grouping_metadata()
      groups.grouping_metadata[1].metadata_choice.value = "Site"
      assert groups.prepare_run(workspace)
      m = workspace.measurements
      assert isinstance(m, cellprofiler_core.measurement.Measurements)
      image_numbers = m.get_image_numbers()
  
      pipeline = workspace.pipeline
      assert isinstance(pipeline, cellprofiler_core.pipeline.Pipeline)
      key_list, groupings = pipeline.get_groupings(workspace)
      assert len(key_list) == 2
      assert key_list[0] == "Metadata_Plate"
      assert key_list[1] == "Metadata_Site"
      assert len(groupings) == 8
  
      idx = 0
      for plate in ("P-12345", "P-23456"):
          for site in ("1", "2", "3", "4"):
              grouping, image_set_list = groupings[idx]
              idx += 1
              assert grouping["Metadata_Plate"] == plate
              assert grouping["Metadata_Site"] == site
              assert len(image_set_list) == 3
              ftr = "_".join(
                  (
                      cellprofiler_core.constants.measurement.C_FILE_NAME,
                      "DNA",
                  )
              )
              for image_number in image_set_list:
                  file_name = m[
                      cellprofiler_core.constants.measurement.IMAGE,
                      ftr,
                      image_number,
                  ]
                  p, w, s, rest = file_name.split("_")
                  assert p == plate
                  assert s == site
  
file_path: CellProfiler/tests/core/modules/test_groups.py
imports: import io
  import os
  import numpy
  import cellprofiler_core.constants.measurement
  import cellprofiler_core.measurement
  import cellprofiler_core.modules.groups
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
  import tests.core
label_desc: Use image node_id 7 for calling a global function with example usage: test_group_on_two() without return types