code: def test_ndcg_bulk_at_top():
      truth = pd.DataFrame.from_records(
          [(1, 50, 3.5), (1, 30, 3.5)],
          columns=["LKTruthID", "item", "rating"],
      ).set_index(["LKTruthID", "item"])
  
      recs = pd.DataFrame.from_records(
          [(1, 1, 50, 1), (1, 1, 30, 2), (1, 1, 72, 3)],
          columns=["LKRecID", "LKTruthID", "item", "rank"],
      )
  
      ndcg = _bulk_ndcg(recs, truth)
      assert len(ndcg) == 1
      assert ndcg.index.tolist() == [1]
      assert ndcg.iloc[0] == approx(1.0)
  
imports: import numpy
  import pandas
  from pytest import approx, mark
  from lenskit.metrics.topn import _dcg, dcg, ndcg, _bulk_ndcg
  from lenskit.topn import RecListAnalysis
  from lenskit.util.test import demo_recs
label_desc: Use image node_id 17 for calling a global function with example usage: test_ndcg_bulk_at_top() without return types