docstr: Tests batch(unbatch) is identity with random graphs.
docstr_tok: ["Tests","batch","(","unbatch",")","is","identity","with","random","graphs","."]
code: def test_batch_unbatch_with_random_graphs(
      self, include_globals, include_nodes, include_edges
  ):
      """Tests batch(unbatch) is identity with random graphs."""
      np.random.seed(42)
      for _ in range(100):
          g = _get_random_graph(
              include_globals=include_globals,
              include_node_features=include_nodes,
              include_edge_features=include_edges,
          )
          jax.tree_util.tree_map(
              np.testing.assert_allclose,
              utils.batch(utils.unbatch(g)),
              g,
          )
  
      for _ in range(10):
          rg = lambda: _get_random_graph(  # pylint: disable=g-long-lambda
              1, include_nodes, include_edges, include_globals
          )
          graphs1 = [rg() for _ in range(np.random.randint(1, 10))]
          graphs2 = utils.unbatch(utils.batch(graphs1))
          for g1, g2 in zip(graphs1, graphs2):
              jax.tree_util.tree_map(np.testing.assert_allclose, g1, g2)
  
imports: import functools
  import os
  from absl.testing import absltest
  from absl.testing import parameterized
  import jax
  from jax.lib import xla_bridge
  import jax.numpy
  import jax.tree_util
  from jraph._src import graph
  from jraph._src import utils
  import numpy
label_desc: Use image node_id 5 for calling the GraphTest obj's underlying member method code with example usage: obj.test_batch_unbatch_with_random_graphs(include_globals, include_nodes, include_edges) without return types