code: def test_module_to_simple(idtype):
      transform = dgl.ToSimple()
      g = dgl.graph(
          ([0, 1, 1], [1, 2, 2]), idtype=idtype, device=F.ctx()
      )
      g.ndata["h"] = F.randn((g.num_nodes(), 2))
      g.edata["w"] = F.tensor([[0.1], [0.2], [0.3]])
      sg = transform(g)
      assert sg.device == g.device
      assert sg.idtype == g.idtype
      assert sg.num_nodes() == g.num_nodes()
      assert sg.num_edges() == 2
      src, dst = sg.edges()
      eset = set(zip(list(F.asnumpy(src)), list(F.asnumpy(dst))))
      assert eset == {(0, 1), (1, 2)}
      assert F.allclose(sg.edata["count"], F.tensor([1, 2]))
      assert F.allclose(sg.ndata["h"], g.ndata["h"])
  
      g = dgl.heterograph(
          {
              ("user", "follows", "user"): ([0, 1, 1], [1, 2, 2]),
              ("user", "plays", "game"): ([0, 1, 0], [1, 1, 1]),
          }
      )
      sg = transform(g)
      assert sg.device == g.device
      assert sg.idtype == g.idtype
      assert sg.ntypes == g.ntypes
      assert sg.canonical_etypes == g.canonical_etypes
      for nty in sg.ntypes:
          assert sg.num_nodes(nty) == g.num_nodes(nty)
      for ety in sg.canonical_etypes:
          assert sg.num_edges(ety) == 2
  
      src, dst = sg.edges(etype="follows")
      eset = set(zip(list(F.asnumpy(src)), list(F.asnumpy(dst))))
      assert eset == {(0, 1), (1, 2)}
  
      src, dst = sg.edges(etype="plays")
      eset = set(zip(list(F.asnumpy(src)), list(F.asnumpy(dst))))
      assert eset == {(0, 1), (1, 1)}
  
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 36 for calling a global function with example usage: test_module_to_simple(idtype) without return types