code: def test_mixed_metrics():
      metric_dict = {
          "cm": skm.confusion_matrix,
          "prec": skm.precision_score,
      }
  
      target = metrics.MetricFrame(
          metrics=metric_dict,
          y_true=y_t,
          y_pred=y_p,
          sensitive_features=g_1,
      )
  
      assert target.overall["prec"] == skm.precision_score(y_t, y_p)
      assert np.array_equal(
          target.overall["cm"], skm.confusion_matrix(y_t, y_p)
      )
  
      for g in np.unique(g_1):
          mask = g_1 == g
  
          expected = skm.confusion_matrix(y_t[mask], y_p[mask])
          actual = target.by_group["cm"][g]
          assert np.array_equal(actual, expected)
  
          expected = skm.precision_score(y_t[mask], y_p[mask])
          actual = target.by_group["prec"][g]
          assert expected == actual
  
file_path: fairlearn/test/unit/metrics/test_metricframe_nonscalar.py
imports: import functools
  import numpy
  import sklearn.metrics
  import fairlearn.metrics
  from .data_for_test import g_1, g_2, y_p, y_t
label_desc: Use image node_id 3 for calling a global function with example usage: test_mixed_metrics() without return types