code: def test_broadcast(idtype, g):
      g = g.astype(idtype).to(F.ctx())
      gfeat = F.randn((g.batch_size, 3))
  
      # Test.0: broadcast_nodes
      g.ndata["h"] = dgl.broadcast_nodes(g, gfeat)
      subg = dgl.unbatch(g)
      for i, sg in enumerate(subg):
          assert F.allclose(
              sg.ndata["h"],
              F.repeat(
                  F.reshape(gfeat[i], (1, 3)), sg.num_nodes(), dim=0
              ),
          )
  
      # Test.1: broadcast_edges
      g.edata["h"] = dgl.broadcast_edges(g, gfeat)
      subg = dgl.unbatch(g)
      for i, sg in enumerate(subg):
          assert F.allclose(
              sg.edata["h"],
              F.repeat(
                  F.reshape(gfeat[i], (1, 3)), sg.num_edges(), dim=0
              ),
          )
  
file_path: dgl/tests/python/common/test_readout.py
imports: import unittest
  import backend
  import dgl
  import networkx
  import numpy
  import pytest
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases
label_desc: Use image node_id 6 for calling a global function with example usage: test_broadcast(idtype, g) without return types