code: def test_pr_bulk_match(demo_recs, drop_rating):
      "bulk and normal match"
      train, test, recs = demo_recs
      if drop_rating:
          test = test[["user", "item"]]
  
      rla = topn.RecListAnalysis()
      rla.add_metric(precision)
      rla.add_metric(recall)
      # metric without the bulk capabilities
      rla.add_metric(lambda *a: precision(*a), name="ind_p")
      rla.add_metric(lambda *a: recall(*a), name="ind_r")
      res = rla.compute(recs, test)
  
      print(res)
      _log.info(
          "precision mismatches:\n%s", res[res.precision != res.ind_p]
      )
      _log.info("recall mismatches:\n%s", res[res.recall != res.ind_r])
  
      assert res.precision.values == approx(res.ind_p.values)
      assert res.recall.values == approx(res.ind_r.values)
  
imports: from pathlib import Path
  import logging
  import numpy
  import pandas
  from pytest import approx, mark
  from lenskit.algorithms.user_knn import UserUser
  from lenskit.algorithms.item_knn import ItemItem
  from lenskit.algorithms.basic import PopScore
  from lenskit.algorithms.ranking import PlackettLuce
  from lenskit.algorithms import Recommender
  from lenskit.util.test import ml_test, demo_recs
  from lenskit.metrics.topn import _dcg, precision, recall
  from lenskit import topn, batch, crossfold
label_desc: Use image node_id 10 for calling a global function with example usage: test_pr_bulk_match(demo_recs, drop_rating) without return types