code: def test_joint_token_counts(self):
      # Count tuples are of the form (TP, FP, FN)
      # All pred tokens are false positives and all ground truth tokens are
      # false negatives when labels are mismatched
  
      # Avoid calling metric_type every time
      check_token_counts = lambda x, y, z: self.check_token_counts(
          x, y, z, metric_type="joint"
      )
  
      # The group to compare against
      base_group = "joint_a_cl"
  
      check_token_counts("joint_a_cl", base_group, (19, 0, 0))
      check_token_counts("joint_a_icl", base_group, (0, 19, 19))
      check_token_counts("joint_a_ml", base_group, (13, 6, 6))
      check_token_counts("joint_a_mil", base_group, (6, 13, 13))
      # Always the same counts when group labels are mismatched
      for tl in ["cl", "icl", "ml", "mil"]:
          check_token_counts(
              "joint_a_nl_" + tl, base_group, (0, 19, 19)
          )
  
      # Group b doesn't overlap with the base group
      for gl in ["", "nl_"]:
          for tl in ["cl", "icl", "ml", "mil"]:
              check_token_counts(
                  "joint_b_" + gl + tl, base_group, (0, 12, 19)
              )
  
      # Note", the tokens "two percent" appear in several text spans of the
      # overlap and superset joints, and are therefore counted as false
      # positives multiple times
  
      check_token_counts("joint_overlap_cl", base_group, (11, 20, 8))
      check_token_counts("joint_overlap_icl", base_group, (0, 31, 19))
      check_token_counts("joint_overlap_ml", base_group, (11, 20, 8))
      check_token_counts("joint_overlap_mil", base_group, (0, 31, 19))
      for tl in ["cl", "icl", "ml", "mil"]:
          check_token_counts(
              "joint_overlap_nl_" + tl, base_group, (0, 31, 19)
          )
  
      check_token_counts("joint_superset_cl", base_group, (19, 17, 0))
      check_token_counts("joint_superset_icl", base_group, (0, 36, 19))
      check_token_counts("joint_superset_ml", base_group, (19, 17, 0))
      check_token_counts("joint_superset_mil", base_group, (0, 36, 19))
      for tl in ["cl", "icl", "ml", "mil"]:
          check_token_counts(
              "joint_superset_nl_" + tl, base_group, (0, 36, 19)
          )
  
      check_token_counts("joint_tokens_cl", base_group, (5, 4, 14))
      check_token_counts("joint_tokens_icl", base_group, (0, 9, 19))
      check_token_counts("joint_tokens_ml", base_group, (5, 4, 14))
      check_token_counts("joint_tokens_mil", base_group, (0, 9, 19))
      for tl in ["cl", "icl", "ml", "mil"]:
          check_token_counts(
              "joint_tokens_nl_" + tl, base_group, (0, 9, 19)
          )
  
      check_token_counts("joint_all_cl", base_group, (19, 16, 0))
      check_token_counts("joint_all_icl", base_group, (0, 35, 19))
      for tl in ["cl", "icl"]:
          check_token_counts(
              "joint_all_nl_" + tl, base_group, (0, 35, 19)
          )
  
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 10 for calling the TestGroupMetricCountFunctions obj's underlying member method code with example usage: obj.test_joint_token_counts() without return types