code: def test_add_node_weight(self):
      self.graph = DAG()
      self.graph.add_node("weighted_a", weight=0.3)
      self.assertEqual(self.graph.nodes["weighted_a"]["weight"], 0.3)
      self.assertEqual(self.graph.latents, set())
  
      self.graph = DAG()
      self.graph.add_node("weighted_a", weight=0.3, latent=True)
      self.assertEqual(self.graph.nodes["weighted_a"]["weight"], 0.3)
      self.assertEqual(self.graph.latents, set(["weighted_a"]))
  
imports: import unittest
  import networkx
  import numpy
  import pgmpy.tests.help_functions
  from pgmpy.base import DAG, PDAG
label_desc: Use image node_id 8 for calling the TestDAGCreation obj's underlying member method code with example usage: obj.test_add_node_weight() without return types