code: def test_rmat_edge_weights(
      include_edge_weights, dtype, min_max_weight, scramble_vertex_ids
  ):
      """
      Verifies that the edge weights returned by rmat() are valid. Also verifies that
      valid values are passed to 'dtype', 'minimum_weight' and 'maximum_weight'.
  
      """
      scale = 2
      num_edges = (2**scale) * 4
      create_using = None  # Returns the edgelist from RMAT
      minimum_weight, maximum_weight = min_max_weight
  
      if include_edge_weights:
          if (
              minimum_weight is None
              or maximum_weight is None
              or dtype
              not in [
                  np.float32,
                  np.float64,
                  cp.float32,
                  cp.float64,
                  "float32",
                  "float64",
              ]
          ):
              with pytest.raises(ValueError):
                  _call_rmat(
                      scale,
                      num_edges,
                      create_using,
                      scramble_vertex_ids=scramble_vertex_ids,
                      include_edge_weights=include_edge_weights,
                      dtype=dtype,
                      minimum_weight=minimum_weight,
                      maximum_weight=maximum_weight,
                  )
          else:
              df = _call_rmat(
                  scale,
                  num_edges,
                  create_using,
                  scramble_vertex_ids=scramble_vertex_ids,
                  include_edge_weights=include_edge_weights,
                  dtype=dtype,
                  minimum_weight=minimum_weight,
                  maximum_weight=maximum_weight,
              )
  
              # Check that there is a 'weights' column
              assert "weights" in df.columns
  
              edge_weights_err1 = df.query(
                  "{} - weights < 0.0001".format(maximum_weight)
              )
              edge_weights_err2 = df.query(
                  "{} - weights > -0.0001".format(minimum_weight)
              )
  
              # Check that edge weights values are between 'minimum_weight'
              # and 'maximum_weight.
              assert len(edge_weights_err1) == 0
              assert len(edge_weights_err2) == 0
      else:
          df = _call_rmat(
              scale,
              num_edges,
              create_using,
              scramble_vertex_ids=scramble_vertex_ids,
              include_edge_weights=include_edge_weights,
              dtype=dtype,
              minimum_weight=minimum_weight,
              maximum_weight=maximum_weight,
          )
          assert len(df.columns) == 2
  
file_path: cugraph/python/cugraph/cugraph/tests/generators/test_rmat.py
imports: import pytest
  import cudf
  import cugraph
  from cugraph.generators import rmat
  from cupy.sparse import coo_matrix, triu, tril
  import numpy
  import cupy
label_desc: Use image node_id 2 for calling a global function with example usage: test_rmat_edge_weights(include_edge_weights, dtype, min_max_weight, scramble_vertex_ids) without return types