code: def test_basic(dtype, device):
      kwargs = dict(dtype=dtype, device=device, sparse_size=(3, 3))
      adj = EdgeIndex([[0, 1, 1, 2], [1, 0, 2, 1]], **kwargs)
      adj.validate()
      assert isinstance(adj, EdgeIndex)
  
      if torch_geometric.typing.WITH_PT112:
          assert str(adj).startswith(
              "EdgeIndex([[0, 1, 1, 2],\n" "           [1, 0, 2, 1]], "
          )
      else:
          assert str(adj).startswith(
              "tensor([[0, 1, 1, 2],\n" "        [1, 0, 2, 1]], "
          )
      assert str(adj).endswith("sparse_size=(3, 3), nnz=4)")
      assert (f"device='{device}'" in str(adj)) == adj.is_cuda
      assert (f"dtype={dtype}" in str(adj)) == (dtype != torch.long)
  
      assert adj.dtype == dtype
      assert adj.device == device
      assert adj.sparse_size() == (3, 3)
      assert adj.sparse_size(0) == 3
      assert adj.sparse_size(-1) == 3
  
      assert adj.sort_order is None
      assert not adj.is_sorted
      assert not adj.is_sorted_by_row
      assert not adj.is_sorted_by_col
  
      assert not adj.is_undirected
  
      out = adj.as_tensor()
      assert not isinstance(out, EdgeIndex)
      assert out.dtype == dtype
      assert out.device == device
  
      out = adj * 1
      assert not isinstance(out, EdgeIndex)
      assert out.dtype == dtype
      assert out.device == device
  
imports: import os.path
  import warnings
  from typing import List, Optional
  import pytest
  import torch
  from torch import Tensor, tensor
  import torch_geometric
  from torch_geometric import EdgeIndex
  from torch_geometric.edge_index import SUPPORTED_DTYPES, ReduceType, SortReturnType, _scatter_spmm, _torch_sparse_spmm, _TorchSPMM, set_tuple_item
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import onlyCUDA, onlyLinux, withCUDA, withoutExtensions, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import scatter
label_desc: Use image node_id 1 for calling a global function with example usage: test_basic(dtype, device) without return types