code: def test_run_one():
      rla = topn.RecListAnalysis()
      rla.add_metric(topn.precision)
      rla.add_metric(topn.recall)
  
      recs = pd.DataFrame({"user": 1, "item": [2]})
      recs.name = "recs"
      truth = pd.DataFrame(
          {"user": 1, "item": [1, 2, 3], "rating": [3.0, 5.0, 4.0]}
      )
      truth.name = "truth"
  
      print(recs)
      print(truth)
  
      res = rla.compute(recs, truth)
      print(res)
  
      assert res.index.name == "user"
      assert res.index.is_unique
  
      assert len(res) == 1
      assert all(res.index == 1)
      assert all(res.precision == 1.0)
      assert res.recall.values == approx(1 / 3)
  
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 3 for calling a global function with example usage: test_run_one() without return types