code: def test_mutation():
      g = dgl.graph([])
      g = g.to(F.ctx())
      # test add nodes with data
      g.add_nodes(5)
      g.add_nodes(5, {"h": F.ones((5, 2))})
      ans = F.cat([F.zeros((5, 2)), F.ones((5, 2))], 0)
      assert F.allclose(ans, g.ndata["h"])
      g.ndata["w"] = 2 * F.ones((10, 2))
      assert F.allclose(2 * F.ones((10, 2)), g.ndata["w"])
      # test add edges with data
      g.add_edges([2, 3], [3, 4])
      g.add_edges([0, 1], [1, 2], {"m": F.ones((2, 2))})
      ans = F.cat([F.zeros((2, 2)), F.ones((2, 2))], 0)
      assert F.allclose(ans, g.edata["m"])
  
imports: import math
  import numbers
  import backend
  import dgl
  import networkx
  import numpy
  import pytest
  import scipy.sparse
  from dgl import DGLError
label_desc: Use image node_id 8 for calling a global function with example usage: test_mutation() without return types