code: def test_as_graphpred():
      ds = data.GINDataset(name="MUTAG", self_loop=True)
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 188
      assert new_ds.num_tasks == 1
      assert new_ds.num_classes == 2
  
      ds = data.FakeNewsDataset("politifact", "profile")
      new_ds = data.AsGraphPredDataset(ds, verbose=True)
      assert len(new_ds) == 314
      assert new_ds.num_tasks == 1
      assert new_ds.num_classes == 2
  
      ds = data.QM7bDataset()
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 7211
      assert new_ds.num_tasks == 14
      assert new_ds.num_classes is None
  
      ds = data.QM9Dataset(label_keys=["mu", "gap"])
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 130831
      assert new_ds.num_tasks == 2
      assert new_ds.num_classes is None
  
      ds = data.QM9EdgeDataset(label_keys=["mu", "alpha"])
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 130831
      assert new_ds.num_tasks == 2
      assert new_ds.num_classes is None
  
      ds = data.TUDataset("DD")
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 1178
      assert new_ds.num_tasks == 1
      assert new_ds.num_classes == 2
  
      ds = data.LegacyTUDataset("DD")
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 1178
      assert new_ds.num_tasks == 1
      assert new_ds.num_classes == 2
  
      ds = data.BA2MotifDataset()
      new_ds = data.AsGraphPredDataset(
          ds, [0.8, 0.1, 0.1], verbose=True
      )
      assert len(new_ds) == 1000
      assert new_ds.num_tasks == 1
      assert new_ds.num_classes == 2
  
imports: import gzip
  import io
  import os
  import tarfile
  import tempfile
  import unittest
  import backend
  import dgl
  import dgl.data
  import numpy
  import pandas
  import pytest
  import yaml
  from dgl import DGLError
label_desc: Use image node_id 9 for calling a global function with example usage: test_as_graphpred() without return types