code: def test_precision_at_k(self):
      # Check non-none results with and without preserve_rows
      self.assertIsNotNone(
          precision_at_k(
              predicted_ranks=self.ranks,
              test_interactions=self.interactions,
              k=5,
              preserve_rows=False,
          )
      )
      self.assertIsNotNone(
          precision_at_k(
              predicted_ranks=self.ranks,
              test_interactions=self.interactions,
              k=5,
              preserve_rows=True,
          )
      )
  
file_path: tensorrec/test/test_eval.py
imports: from unittest import TestCase
  from numpy.random import shuffle
  import numpy
  import scipy.sparse
  from tensorrec import TensorRec
  from tensorrec.eval import recall_at_k, precision_at_k, f1_score_at_k, ndcg_at_k
  from tensorrec.eval import _setup_ndcg, _idcg, _dcg
  from tensorrec.util import generate_dummy_data_with_indicator
label_desc: Use image node_id 3 for calling the EvalTestCase obj's underlying member method code with example usage: obj.test_precision_at_k() without return types