code: def test_module_remove_self_loop(idtype):
      transform = dgl.RemoveSelfLoop()
  
      # Case1: homogeneous graph
      g = dgl.graph(([1, 1], [1, 2]), idtype=idtype, device=F.ctx())
      g.ndata["h"] = F.randn((g.num_nodes(), 2))
      g.edata["w"] = F.randn((g.num_edges(), 3))
      new_g = transform(g)
      assert new_g.device == g.device
      assert new_g.idtype == g.idtype
      assert new_g.num_nodes() == g.num_nodes()
      assert new_g.num_edges() == 1
      src, dst = new_g.edges()
      eset = set(zip(list(F.asnumpy(src)), list(F.asnumpy(dst))))
      assert eset == {(1, 2)}
      assert "h" in new_g.ndata
      assert "w" in new_g.edata
  
      # Case2: heterogeneous graph
      g = dgl.heterograph(
          {
              ("user", "plays", "game"): ([0, 1], [1, 1]),
              ("user", "follows", "user"): ([1, 2], [2, 2]),
          },
          idtype=idtype,
          device=F.ctx(),
      )
      g.nodes["user"].data["h1"] = F.randn((3, 2))
      g.edges["plays"].data["w1"] = F.randn((2, 3))
      g.nodes["game"].data["h2"] = F.randn((2, 4))
      g.edges["follows"].data["w2"] = F.randn((2, 5))
  
      new_g = transform(g)
      assert new_g.device == g.device
      assert new_g.idtype == g.idtype
      assert new_g.ntypes == g.ntypes
      assert new_g.canonical_etypes == g.canonical_etypes
      for nty in new_g.ntypes:
          assert new_g.num_nodes(nty) == g.num_nodes(nty)
      assert new_g.num_edges("plays") == 2
      assert new_g.num_edges("follows") == 1
      assert "h1" in new_g.nodes["user"].data
      assert "h2" in new_g.nodes["game"].data
      assert "w1" in new_g.edges["plays"].data
      assert "w2" in new_g.edges["follows"].data
  
imports: import math
  import os
  import unittest
  import backend
  import dgl
  import dgl.function
  import dgl.partition
  import networkx
  import numpy
  import pytest
  from scipy import sparse
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases
label_desc: Use image node_id 34 for calling a global function with example usage: test_module_remove_self_loop(idtype) without return types