code: def test_as_linkpred():
      # create
      ds = data.AsLinkPredDataset(
          data.CoraGraphDataset(),
          split_ratio=[0.8, 0.1, 0.1],
          neg_ratio=1,
          verbose=True,
      )
      # Cora has 10556 edges, 10% test edges can be 1057
      assert ds.test_edges[0][0].shape[0] == 1057
      # negative samples, not guaranteed, so the assert is in a relaxed range
      assert 1000 <= ds.test_edges[1][0].shape[0] <= 1057
      # read from cache
      ds = data.AsLinkPredDataset(
          data.CoraGraphDataset(),
          split_ratio=[0.7, 0.1, 0.2],
          neg_ratio=2,
          verbose=True,
      )
      assert ds.test_edges[0][0].shape[0] == 2112
      # negative samples, not guaranteed to be ratio 2, so the assert is in a relaxed range
      assert 4000 < ds.test_edges[1][0].shape[0] <= 4224
  
imports: import gzip
  import io
  import os
  import tarfile
  import tempfile
  import unittest
  import warnings
  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 33 for calling a global function with example usage: test_as_linkpred() without return types