code: def test_group_assignment_rectangle(self):
      count_fn = get_count_fn("group", "exact")
      groups_a = self.base_groups
      groups_b = self.base_groups[:2]
  
      # Normal
      correct_idxs = [(0, 0), (1, 1)]
      correct_counts = [
          [(1, 0, 0), (0, 1, 1)],
          [(0, 1, 1), (1, 0, 0)],
          [(0, 1, 1), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn, groups_a, groups_b, correct_idxs, correct_counts
      )
  
      correct_counts = [
          [(1, 0, 0), (0, 1, 1), (0, 1, 1)],
          [(0, 1, 1), (1, 0, 0), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn, groups_b, groups_a, correct_idxs, correct_counts
      )
  
      # Group a inverted
      correct_idxs = [(1, 1), (2, 0)]
      correct_counts = [
          [(0, 1, 1), (0, 1, 1)],
          [(0, 1, 1), (1, 0, 0)],
          [(1, 0, 0), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn,
          groups_a[::-1],
          groups_b,
          correct_idxs,
          correct_counts,
      )
  
      correct_idxs = [(0, 2), (1, 1)]
      correct_counts = [
          [(0, 1, 1), (0, 1, 1), (1, 0, 0)],
          [(0, 1, 1), (1, 0, 0), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn,
          groups_b,
          groups_a[::-1],
          correct_idxs,
          correct_counts,
      )
  
      # Group b inverted
      correct_idxs = [(0, 1), (1, 0)]
      correct_counts = [
          [(0, 1, 1), (1, 0, 0)],
          [(1, 0, 0), (0, 1, 1)],
          [(0, 1, 1), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn,
          groups_a,
          groups_b[::-1],
          correct_idxs,
          correct_counts,
      )
  
      correct_idxs = [(0, 1), (1, 0)]
      correct_counts = [
          [(0, 1, 1), (1, 0, 0), (0, 1, 1)],
          [(1, 0, 0), (0, 1, 1), (0, 1, 1)],
      ]
      self.check_group_assignment(
          count_fn,
          groups_b[::-1],
          groups_a,
          correct_idxs,
          correct_counts,
      )
  
imports: import unittest
  from copy import deepcopy
  from finetune.util.group_metrics import get_count_fn, calc_group_assignment, create_joint_groups, get_metrics, group_metrics, joint_metrics
label_desc: Use image node_id 3 for calling the TestGroupMetrics obj's underlying member method code with example usage: obj.test_group_assignment_rectangle() without return types