code: def test_make_precision_fn(self):
      with tf.Graph().as_default():
          scores = [[1.0, 3.0, 2.0], [1.0, 2.0, 3.0]]
          labels = [[0.0, 0.0, 1.0], [0.0, 1.0, 2.0]]
          features = {}
          m = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PRECISION
          )
          m_top_1 = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PRECISION, topn=1
          )
          m_top_2 = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PRECISION, topn=2
          )
          self._check_metrics(
              [
                  (m([labels[0]], [scores[0]], features), 1.0 / 3.0),
                  (
                      m_top_1([labels[0]], [scores[0]], features),
                      0.0 / 1.0,
                  ),
                  (
                      m_top_2([labels[0]], [scores[0]], features),
                      1.0 / 2.0,
                  ),
                  (
                      m(labels, scores, features),
                      (1.0 / 3.0 + 2.0 / 3.0) / 2.0,
                  ),
              ]
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import tensorflow
  from tensorflow_ranking.python import metrics
label_desc: Use image node_id 7 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_make_precision_fn() without return types