code: def test_minibatch_representation_homo():
      csc_formats = [
          gb.CSCFormatBase(
              indptr=torch.tensor([0, 1, 3, 5, 6]),
              indices=torch.tensor([0, 1, 2, 2, 1, 2]),
          ),
          gb.CSCFormatBase(
              indptr=torch.tensor([0, 2, 3]),
              indices=torch.tensor([1, 2, 0]),
          ),
      ]
      original_column_node_ids = [
          torch.tensor([10, 11, 12, 13]),
          torch.tensor([10, 11]),
      ]
      original_row_node_ids = [
          torch.tensor([10, 11, 12, 13]),
          torch.tensor([10, 11, 12]),
      ]
      original_edge_ids = [
          torch.tensor([19, 20, 21, 22, 25, 30]),
          torch.tensor([10, 15, 17]),
      ]
      node_features = {"x": torch.tensor([5, 0, 2, 1])}
      edge_features = [
          {"x": torch.tensor([9, 0, 1, 1, 7, 4])},
          {"x": torch.tensor([0, 2, 2])},
      ]
      subgraphs = []
      for i in range(2):
          subgraphs.append(
              gb.SampledSubgraphImpl(
                  sampled_csc=csc_formats[i],
                  original_column_node_ids=original_column_node_ids[i],
                  original_row_node_ids=original_row_node_ids[i],
                  original_edge_ids=original_edge_ids[i],
              )
          )
      negative_srcs = torch.tensor([[8], [1], [6]])
      negative_dsts = torch.tensor([[2], [8], [8]])
      input_nodes = torch.tensor([8, 1, 6, 5, 9, 0, 2, 4])
      compacted_csc_formats = gb.CSCFormatBase(
          indptr=torch.tensor([0, 2, 3]),
          indices=torch.tensor([3, 4, 5]),
      )
      compacted_negative_srcs = torch.tensor([[0], [1], [2]])
      compacted_negative_dsts = torch.tensor([[6], [0], [0]])
      labels = torch.tensor([0.0, 1.0, 2.0])
      # Test minibatch without data.
      minibatch = gb.MiniBatch()
      expect_result = str(
          """MiniBatch(seed_nodes=None,
            sampled_subgraphs=None,
            positive_node_pairs=None,
            node_pairs_with_labels=None,
            node_pairs=None,
            node_features=None,
            negative_srcs=None,
            negative_node_pairs=None,
            negative_dsts=None,
            labels=None,
            input_nodes=None,
            edge_features=None,
            compacted_node_pairs=None,
            compacted_negative_srcs=None,
            compacted_negative_dsts=None,
            blocks=None,
         )"""
      )
      result = str(minibatch)
      assert result == expect_result, print(
          len(expect_result), len(result)
      )
      # Test minibatch with all attributes.
      minibatch = gb.MiniBatch(
          node_pairs=csc_formats,
          sampled_subgraphs=subgraphs,
          labels=labels,
          node_features=node_features,
          edge_features=edge_features,
          negative_srcs=negative_srcs,
          negative_dsts=negative_dsts,
          compacted_node_pairs=compacted_csc_formats,
          input_nodes=input_nodes,
          compacted_negative_srcs=compacted_negative_srcs,
          compacted_negative_dsts=compacted_negative_dsts,
      )
      expect_result = str(
          """MiniBatch(seed_nodes=None,
            sampled_subgraphs=[SampledSubgraphImpl(sampled_csc=CSCFormatBase(indptr=tensor([0, 1, 3, 5, 6]),
                                                                           indices=tensor([0, 1, 2, 2, 1, 2]),
                                                             ),
                                                 original_row_node_ids=tensor([10, 11, 12, 13]),
                                                 original_edge_ids=tensor([19, 20, 21, 22, 25, 30]),
                                                 original_column_node_ids=tensor([10, 11, 12, 13]),
                              ),
                              SampledSubgraphImpl(sampled_csc=CSCFormatBase(indptr=tensor([0, 2, 3]),
                                                                           indices=tensor([1, 2, 0]),
                                                             ),
                                                 original_row_node_ids=tensor([10, 11, 12]),
                                                 original_edge_ids=tensor([10, 15, 17]),
                                                 original_column_node_ids=tensor([10, 11]),
                              )],
            positive_node_pairs=CSCFormatBase(indptr=tensor([0, 2, 3]),
                                              indices=tensor([3, 4, 5]),
                                ),
            node_pairs_with_labels=(CSCFormatBase(indptr=tensor([0, 2, 3]),
                                                 indices=tensor([3, 4, 5]),
                                   ),
                                   tensor([0., 1., 2.])),
            node_pairs=[CSCFormatBase(indptr=tensor([0, 1, 3, 5, 6]),
                                     indices=tensor([0, 1, 2, 2, 1, 2]),
                       ),
                       CSCFormatBase(indptr=tensor([0, 2, 3]),
                                     indices=tensor([1, 2, 0]),
                       )],
            node_features={'x': tensor([5, 0, 2, 1])},
            negative_srcs=tensor([[8],
                                  [1],
                                  [6]]),
            negative_node_pairs=(tensor([[0],
                                        [1],
                                        [2]]),
                                tensor([[6],
                                        [0],
                                        [0]])),
            negative_dsts=tensor([[2],
                                  [8],
                                  [8]]),
            labels=tensor([0., 1., 2.]),
            input_nodes=tensor([8, 1, 6, 5, 9, 0, 2, 4]),
            edge_features=[{'x': tensor([9, 0, 1, 1, 7, 4])},
                          {'x': tensor([0, 2, 2])}],
            compacted_node_pairs=CSCFormatBase(indptr=tensor([0, 2, 3]),
                                               indices=tensor([3, 4, 5]),
                                 ),
            compacted_negative_srcs=tensor([[0],
                                            [1],
                                            [2]]),
            compacted_negative_dsts=tensor([[6],
                                            [0],
                                            [0]]),
            blocks=[Block(num_src_nodes=4, num_dst_nodes=4, num_edges=6),
                   Block(num_src_nodes=3, num_dst_nodes=2, num_edges=3)],
         )"""
      )
      result = str(minibatch)
      assert result == expect_result, print(expect_result, result)
  
file_path: dgl/tests/python/pytorch/graphbolt/impl/test_minibatch.py
imports: import dgl
  import dgl.graphbolt
  import pytest
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: test_minibatch_representation_homo() without return types