code: def test_hetero_link_neighbor_loader_loop(subgraph_type):
      data = HeteroData()
  
      data["paper"].x = torch.arange(100)
      data["author"].x = torch.arange(100, 300)
  
      data["paper", "paper"].edge_index = get_random_edge_index(
          100, 100, 500
      )
      data["paper", "author"].edge_index = get_random_edge_index(
          100, 200, 1000
      )
      data["author", "paper"].edge_index = get_random_edge_index(
          200, 100, 1000
      )
  
      loader = LinkNeighborLoader(
          data,
          num_neighbors=[-1] * 2,
          edge_label_index=("paper", "paper"),
          batch_size=20,
          subgraph_type=subgraph_type,
      )
  
      for batch in loader:
          assert batch["paper"].x.size(0) <= 100
          assert (
              batch["paper"].x.min() >= 0
              and batch["paper"].x.max() < 100
          )
  
          # Assert positive samples are present in the original graph:
          edge_index = unique_edge_pairs(
              batch["paper", "paper"].edge_index
          )
          edge_label_index = batch["paper", "paper"].edge_label_index
          edge_label_index = unique_edge_pairs(edge_label_index)
          assert len(edge_index | edge_label_index) == len(edge_index)
  
file_path: pytorch_geometric/test/loader/test_link_neighbor_loader.py
imports: import pytest
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.loader import LinkNeighborLoader
  from torch_geometric.testing import MyFeatureStore, MyGraphStore, get_random_edge_index, onlyNeighborSampler, withCUDA, withPackage
label_desc: Use image node_id 4 for calling a global function with example usage: test_hetero_link_neighbor_loader_loop(subgraph_type) without return types