code: def test_edge_index(tmp_path):
      edge_index1 = EdgeIndex(
          [[0, 1, 1, 2], [1, 0, 2, 1]],
          sparse_size=(3, 3),
          sort_order="row",
          is_undirected=True,
      )
      edge_index2 = EdgeIndex(
          [[1, 0, 2, 1, 3, 2], [0, 1, 1, 2, 2, 3]],
          sparse_size=(4, 4),
          sort_order="col",
      )
  
      data1 = Data(edge_index=edge_index1)
      data2 = Data(edge_index=edge_index2)
  
      dataset = MyTestDataset([data1, data2])
      assert len(dataset) == 2
      for data, edge_index in zip(dataset, [edge_index1, edge_index2]):
          assert isinstance(data.edge_index, EdgeIndex)
          assert data.edge_index.equal(edge_index)
          assert (
              data.edge_index.sparse_size() == edge_index.sparse_size()
          )
          assert data.edge_index.sort_order == edge_index.sort_order
          assert (
              data.edge_index.is_undirected == edge_index.is_undirected
          )
  
      dataset = MyStoredTestDataset(tmp_path, [data1, data2])
      assert len(dataset) == 2
      for data, edge_index in zip(dataset, [edge_index1, edge_index2]):
          assert isinstance(data.edge_index, EdgeIndex)
          assert data.edge_index.equal(edge_index)
          assert (
              data.edge_index.sparse_size() == edge_index.sparse_size()
          )
          assert data.edge_index.sort_order == edge_index.sort_order
          assert (
              data.edge_index.is_undirected == edge_index.is_undirected
          )
  
imports: import copy
  import pytest
  import torch
  from torch_geometric import EdgeIndex
  from torch_geometric.data import Data, HeteroData, InMemoryDataset
  from torch_geometric.datasets import KarateClub
  from torch_geometric.testing import withPackage
  from torch_geometric.transforms import BaseTransform
  from torch_geometric.typing import SparseTensor
label_desc: Use image node_id 4 for calling a global function with example usage: test_edge_index(tmp_path) without return types