test_cases = [ { "predictions": [0, 0], "references": [1, 1], "result": {"mean_reciprocal_rank": 1.0}, }, ] from mean_reciprocal_rank import mean_reciprocal_rank m = mean_reciprocal_rank() for test_case in test_cases: assert ( m.compute( predictions=test_case["predictions"], references=test_case["references"] ) == test_case["result"] )