code: def test_parses_a_libsvm_ranking_dataset(self):
      results = iter(
          LibSVMRankingParser(
              _TEST_DATASET.split("\n"),
              feature_names={
                  1: "bm25",
                  2: "tfidf",
                  3: "querylen",
                  4: "doclen",
                  5: "qualityscore",
              },
          )
      )
  
      qid, features = next(results)
      self.assertEqual(qid, "1")
      self.assertEqual(features["query_id"], "1")
      self.assertAllEqual(features["doc_id"], [2, 3, 4, 5])
      self.assertAllEqual(features["label"], [3.0, 1.0, 0.0, 0.0])
      self.assertAllEqual(features["bm25"], [1.0, 0.0, 0.0, 0.0])
      self.assertAllEqual(features["tfidf"], [1.0, 0.0, 1.0, 0.0])
      self.assertAllEqual(features["querylen"], [0.0, 1.0, 0.0, 1.0])
      self.assertAllEqual(features["doclen"], [0.2, 0.1, 0.4, 0.3])
      self.assertAllEqual(features["qualityscore"], [0.0, 1.0, 0.0, 0])
  
      qid, features = next(results)
      self.assertEqual(qid, "2")
      self.assertEqual(features["query_id"], "2")
      self.assertAllEqual(features["doc_id"], [6, 7, 11, 12, 16, 18])
      self.assertAllEqual(
          features["label"], [0.0, 1.0, 0.0, 0.0, 1.0, 2.0]
      )
      self.assertAllEqual(
          features["bm25"], [0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
      )
      self.assertAllEqual(
          features["tfidf"], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
      )
      self.assertAllEqual(
          features["querylen"], [1.0, 1.0, 1.0, 1.0, 1.0, 0.0]
      )
      self.assertAllEqual(
          features["doclen"], [0.2, 0.4, 0.1, 0.2, 0.1, 0.3]
      )
      self.assertAllEqual(
          features["qualityscore"], [0.0, 0.0, 0.0, 0.0, 1.0, 0.0]
      )
  
      qid, features = next(results)
      self.assertEqual(qid, "3")
      self.assertEqual(features["query_id"], "3")
      self.assertAllEqual(features["doc_id"], [19, 20])
      self.assertAllEqual(features["label"], [3.0, 0.0])
      self.assertAllEqual(features["bm25"], [1.0, 0.0])
      self.assertAllEqual(features["tfidf"], [0.0, 1.0])
      self.assertAllEqual(features["querylen"], [0.0, 1.0])
      self.assertAllEqual(features["doclen"], [0.4, 0.5])
      self.assertAllEqual(features["qualityscore"], [1.0, 0.0])
  
      # Assert that the end of the file has been reached.
      with self.assertRaises(StopIteration):
          next(results)
  
file_path: datasets/tensorflow_datasets/ranking/libsvm_ranking_parser_test.py
imports: from tensorflow_datasets import testing
  from tensorflow_datasets.ranking.libsvm_ranking_parser import LibSVMRankingParser
  from tensorflow_datasets.ranking.libsvm_ranking_parser import ParserError
label_desc: Use image node_id 1 for calling the LibSVMRankingParserTest obj's underlying member method code with example usage: obj.test_parses_a_libsvm_ranking_dataset() without return types