code: def test_popular():
      algo = basic.Popular()
      algo.fit(lktu.ml_test.ratings)
      counts = lktu.ml_test.ratings.groupby("item").user.count()
      counts = counts.nlargest(100)
  
      assert algo.item_pop_.max() == counts.max()
  
      recs = algo.recommend(2038, 100)
      assert len(recs) == 100
      assert all(np.diff(recs.score) <= 0)
  
      assert recs.score.iloc[0] == counts.max()
      # the 10 most popular should be the same
      assert all(counts.index[:10] == recs.item[:10])
  
file_path: lkpy/tests/test_popular.py
imports: from lenskit.algorithms import basic
  import pandas
  import numpy
  import pickle
  import lenskit.util.test
label_desc: Use image node_id 1 for calling a global function with example usage: test_popular() without return types