code: def test_negative_sampling_edge_case_heterogeneous(self):
      # complete graph
      G = generate_simple_dense_hete_graph()
      graph = HeteroGraph(G)
      graphs = [graph]
      dataset = GraphDataset(graphs, task="link_pred")
      self.assertRaises(ValueError, dataset[0]._create_neg_sampling, 1)
  
      # complete graph except 1 missing edge
      G = generate_simple_dense_hete_graph(num_edges_removed=1)
      graph = HeteroGraph(G)
      graphs = [graph]
      dataset = GraphDataset(graphs, task="link_pred")
      dataset[0]._create_neg_sampling(1)
      for message_type in dataset[0].message_types:
          num_edges = dataset[0].num_edges(message_type)
          self.assertEqual(
              dataset[0].edge_label[message_type].shape[0],
              2 * num_edges,
          )
  
      # complete multigraph
      G = generate_simple_dense_hete_multigraph()
      graph = HeteroGraph(G)
      graphs = [graph]
      dataset = GraphDataset(graphs, task="link_pred")
      self.assertRaises(ValueError, dataset[0]._create_neg_sampling, 1)
  
      # complete multigraph except 1 missing edge
      G = generate_simple_dense_hete_multigraph(num_edges_removed=1)
      graph = HeteroGraph(G)
      graphs = [graph]
      dataset = GraphDataset(graphs, task="link_pred")
      dataset[0]._create_neg_sampling(1)
      for message_type in dataset[0].message_types:
          num_edges = dataset[0].num_edges(message_type)
          self.assertEqual(
              dataset[0].edge_label[message_type].shape[0],
              2 * num_edges,
          )
  
imports: import random
  import torch
  import unittest
  from torch_geometric.datasets import TUDataset, Planetoid
  from copy import deepcopy
  from deepsnap.graph import Graph
  from deepsnap.hetero_graph import HeteroGraph
  from deepsnap.dataset import GraphDataset, Generator, EnsembleGenerator
  from tests.utils import simple_networkx_graph, simple_networkx_small_graph, simple_networkx_graph_alphabet, simple_networkx_dense_graph, simple_networkx_dense_multigraph, simple_networkx_multigraph, generate_dense_hete_dataset, generate_simple_small_hete_graph, generate_simple_dense_hete_graph, generate_simple_dense_hete_multigraph, generate_dense_hete_multigraph, gen_graph
label_desc: Use image node_id 14 for calling the TestDataset obj's underlying member method code with example usage: obj.test_negative_sampling_edge_case_heterogeneous() without return types