def test_ndcg_score(self):
        """Different k."""
        ground_truth = [1, 0, 2]
        predictions = [[0.35, 0.05, 0.2], [0.1, 0.2, 0.3], [0.6, 0.04, 0.59]]
        score = ndcg_score(ground_truth, predictions, k=1)
        assert score == 0

        score = ndcg_score(ground_truth, predictions, k=2)
        assert score == 0.2103099178571525

        score = ndcg_score(ground_truth, predictions, k=3)
        assert score == 0.54364325119048584
    def test_ndcg_score(self):
        """Different k."""
        ground_truth = [1, 0, 2]
        predictions = [
            [0.35, 0.05, 0.2],
            [0.1, 0.2, 0.3],
            [0.6, 0.04, 0.59]
        ]
        score = ndcg_score(ground_truth, predictions, k=1)
        assert score == 0

        score = ndcg_score(ground_truth, predictions, k=2)
        assert score == 0.2103099178571525

        score = ndcg_score(ground_truth, predictions, k=3)
        assert score == 0.54364325119048584
 def test_ndcg_score_perfect(self):
     """Perfect NDCG case."""
     ground_truth = [1, 0, 2]
     predictions = [
         [0.15, 0.55, 0.2],
         [0.7, 0.2, 0.1],
         [0.06, 0.04, 0.9]
     ]
     score = ndcg_score(ground_truth, predictions)
     assert score == 1.0
 def test_ndcg_score_perfect(self):
     """Perfect NDCG case."""
     ground_truth = [1, 0, 2]
     predictions = [[0.15, 0.55, 0.2], [0.7, 0.2, 0.1], [0.06, 0.04, 0.9]]
     score = ndcg_score(ground_truth, predictions)
     assert score == 1.0