code: def distdataloader_test(g, batch_size, drop_last, shuffle):
      # We sample only a subset to minimize the test runtime
      num_nodes_to_sample = int(g.num_nodes() * 0.05)
      # To make sure that drop_last is tested
      if num_nodes_to_sample % batch_size == 0:
          num_nodes_to_sample -= 1
  
      orig_nid_map = dict()
      dtype = g.edges[g.etypes[0]].data["edge_u"].dtype
      for ntype in g.ntypes:
          orig_nid = F.tensor(
              np.load(graph_path + f"/orig_nid_array_{ntype}.npy"),
              dtype,
          )
          orig_nid_map[ntype] = orig_nid
  
      orig_uv_map = dict()
      for etype in g.etypes:
          orig_uv_map[etype] = (
              g.edges[etype].data["edge_u"],
              g.edges[etype].data["edge_v"],
          )
  
      if len(g.ntypes) == 1:
          train_nid = F.arange(0, num_nodes_to_sample)
      else:
          train_nid = {g.ntypes[0]: F.arange(0, num_nodes_to_sample)}
  
      sampler = NeighborSampler(
          g, [5, 10], dgl.distributed.sample_neighbors
      )
  
      dataloader = dgl.dataloading.DistDataLoader(
          dataset=train_nid.numpy(),
          batch_size=batch_size,
          collate_fn=sampler.sample_blocks,
          shuffle=shuffle,
          drop_last=drop_last,
      )
  
      for _ in range(2):
          max_nid = []
          for idx, blocks in zip(
              range(0, num_nodes_to_sample, batch_size), dataloader
          ):
              block = blocks[-1]
              for src_type, etype, dst_type in block.canonical_etypes:
                  orig_u, orig_v = orig_uv_map[etype]
                  o_src, o_dst = block.edges(etype=etype)
                  src_nodes_id = block.srcnodes[src_type].data[dgl.NID][
                      o_src
                  ]
                  dst_nodes_id = block.dstnodes[dst_type].data[dgl.NID][
                      o_dst
                  ]
                  max_nid.append(np.max(F.asnumpy(dst_nodes_id)))
  
                  src_nodes_id = orig_nid_map[src_type][src_nodes_id]
                  dst_nodes_id = orig_nid_map[dst_type][dst_nodes_id]
                  eids = block.edata["original_eids"]
                  F.allclose(src_nodes_id, orig_u[eids])
                  F.allclose(dst_nodes_id, orig_v[eids])
          if not shuffle and len(max_nid) > 0:
              if drop_last:
                  assert (
                      np.max(max_nid)
                      == num_nodes_to_sample
                      - 1
                      - num_nodes_to_sample % batch_size
                  )
              else:
                  assert np.max(max_nid) == num_nodes_to_sample - 1
      del dataloader
  
imports: import json
  import os
  from itertools import product
  import dgl
  import dgl.backend
  import numpy
  from dgl.distributed import edge_split, load_partition_book, node_split
label_desc: Use image node_id 22 for calling a global function with example usage: distdataloader_test(g, batch_size, drop_last, shuffle) without return types