code: def test_RangePartitionBook():
      part_id = 1
      num_parts = 2
  
      # homogeneous
      node_map = {DEFAULT_NTYPE: F.tensor([[0, 1000], [1000, 2000]])}
      edge_map = {DEFAULT_ETYPE: F.tensor([[0, 5000], [5000, 10000]])}
      ntypes = {DEFAULT_NTYPE: 0}
      etypes = {DEFAULT_ETYPE: 0}
      gpb = RangePartitionBook(
          part_id, num_parts, node_map, edge_map, ntypes, etypes
      )
      assert gpb.etypes == [DEFAULT_ETYPE[1]]
      assert gpb.canonical_etypes == [DEFAULT_ETYPE]
      assert gpb.to_canonical_etype(DEFAULT_ETYPE[1]) == DEFAULT_ETYPE
  
      node_policy = NodePartitionPolicy(gpb, DEFAULT_NTYPE)
      assert node_policy.type_name == DEFAULT_NTYPE
      edge_policy = EdgePartitionPolicy(gpb, DEFAULT_ETYPE)
      assert edge_policy.type_name == DEFAULT_ETYPE
  
      # Init via etype is not supported
      node_map = {
          "node1": F.tensor([[0, 1000], [1000, 2000]]),
          "node2": F.tensor([[0, 1000], [1000, 2000]]),
      }
      edge_map = {"edge1": F.tensor([[0, 5000], [5000, 10000]])}
      ntypes = {"node1": 0, "node2": 1}
      etypes = {"edge1": 0}
      expect_except = False
      try:
          RangePartitionBook(
              part_id, num_parts, node_map, edge_map, ntypes, etypes
          )
      except AssertionError:
          expect_except = True
      assert expect_except
      expect_except = False
      try:
          EdgePartitionPolicy(gpb, "edge1")
      except AssertionError:
          expect_except = True
      assert expect_except
  
      # heterogeneous, init via canonical etype
      node_map = {
          "node1": F.tensor([[0, 1000], [1000, 2000]]),
          "node2": F.tensor([[0, 1000], [1000, 2000]]),
      }
      edge_map = {
          ("node1", "edge1", "node2"): F.tensor(
              [[0, 5000], [5000, 10000]]
          )
      }
      ntypes = {"node1": 0, "node2": 1}
      etypes = {("node1", "edge1", "node2"): 0}
      c_etype = list(etypes.keys())[0]
      gpb = RangePartitionBook(
          part_id, num_parts, node_map, edge_map, ntypes, etypes
      )
      assert gpb.etypes == ["edge1"]
      assert gpb.canonical_etypes == [c_etype]
      assert gpb.to_canonical_etype("edge1") == c_etype
      assert gpb.to_canonical_etype(c_etype) == c_etype
      expect_except = False
      try:
          gpb.to_canonical_etype(("node1", "edge2", "node2"))
      except BaseException:
          expect_except = True
      assert expect_except
      expect_except = False
      try:
          gpb.to_canonical_etype("edge2")
      except BaseException:
          expect_except = True
      assert expect_except
  
      # NodePartitionPolicy
      node_policy = NodePartitionPolicy(gpb, "node1")
      assert node_policy.type_name == "node1"
      assert node_policy.policy_str == "node~node1"
      assert node_policy.part_id == part_id
      assert node_policy.is_node
      assert node_policy.get_data_name("x").is_node()
      local_ids = th.arange(0, 1000)
      global_ids = local_ids + 1000
      assert th.equal(node_policy.to_local(global_ids), local_ids)
      assert th.all(node_policy.to_partid(global_ids) == part_id)
      assert node_policy.get_part_size() == 1000
      assert node_policy.get_size() == 2000
  
      # EdgePartitionPolicy
      edge_policy = EdgePartitionPolicy(gpb, c_etype)
      assert edge_policy.type_name == c_etype
      assert edge_policy.policy_str == "edge~node1:edge1:node2"
      assert edge_policy.part_id == part_id
      assert not edge_policy.is_node
      assert not edge_policy.get_data_name("x").is_node()
      local_ids = th.arange(0, 5000)
      global_ids = local_ids + 5000
      assert th.equal(edge_policy.to_local(global_ids), local_ids)
      assert th.all(edge_policy.to_partid(global_ids) == part_id)
      assert edge_policy.get_part_size() == 5000
      assert edge_policy.get_size() == 10000
  
      expect_except = False
      try:
          HeteroDataName(False, "edge1", "feat")
      except BaseException:
          expect_except = True
      assert expect_except
      data_name = HeteroDataName(False, c_etype, "feat")
      assert data_name.get_type() == c_etype
  
imports: import json
  import os
  import tempfile
  import backend
  import dgl
  import numpy
  import pytest
  import torch
  from dgl import function
  from dgl.distributed import convert_dgl_partition_to_csc_sampling_graph, load_partition, load_partition_book, load_partition_feats, partition_graph
  from dgl.distributed.graph_partition_book import _etype_str_to_tuple, _etype_tuple_to_str, DEFAULT_ETYPE, DEFAULT_NTYPE, EdgePartitionPolicy, HeteroDataName, NodePartitionPolicy, RangePartitionBook
  from dgl.distributed.partition import _get_inner_edge_mask, _get_inner_node_mask, RESERVED_FIELD_DTYPE
  from scipy import sparse
  from utils import reset_envs
label_desc: Use image node_id 10 for calling a global function with example usage: test_RangePartitionBook() without return types