code: def test_union_init(self):
      self.assertSetEqual(self.union.latents, set())
      self.assertSetEqual(
          self.union.observed,
          {"yrsmill", "unionsen", "age", "laboract", "deferenc"},
      )
  
      self.assertListEqual(
          sorted(self.union.graph.nodes()),
          sorted(
              ["yrsmill", "unionsen", "age", "laboract", "deferenc"]
          ),
      )
      self.assertListEqual(
          sorted(self.union.graph.edges()),
          sorted(
              [
                  ("yrsmill", "unionsen"),
                  ("age", "laboract"),
                  ("age", "deferenc"),
                  ("deferenc", "laboract"),
                  ("deferenc", "unionsen"),
                  ("laboract", "unionsen"),
              ]
          ),
      )
  
      self.assertDictEqual(
          self.union.graph.edges[("yrsmill", "unionsen")],
          {"weight": np.NaN},
      )
      self.assertDictEqual(
          self.union.graph.edges[("age", "laboract")],
          {"weight": np.NaN},
      )
      self.assertDictEqual(
          self.union.graph.edges[("age", "deferenc")],
          {"weight": np.NaN},
      )
      self.assertDictEqual(
          self.union.graph.edges[("deferenc", "laboract")],
          {"weight": np.NaN},
      )
      self.assertDictEqual(
          self.union.graph.edges[("deferenc", "unionsen")],
          {"weight": np.NaN},
      )
      self.assertDictEqual(
          self.union.graph.edges[("laboract", "unionsen")],
          {"weight": np.NaN},
      )
  
      npt.assert_equal(
          nx.to_numpy_array(
              self.union.err_graph,
              nodelist=sorted(self.union.err_graph.nodes()),
              weight=None,
          ),
          np.array(
              [
                  [0.0, 0.0, 0.0, 0.0, 1.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0, 0.0, 0.0],
              ]
          ),
      )
  
      for edge in self.union.err_graph.edges():
          self.assertDictEqual(
              self.union.err_graph.edges[edge], {"weight": np.NaN}
          )
      for node in self.union.err_graph.nodes():
          self.assertDictEqual(
              self.union.err_graph.nodes[node], {"weight": np.NaN}
          )
  
imports: import os
  import unittest
  import networkx
  import numpy
  import numpy.testing
  from pgmpy.models import SEM, SEMAlg, SEMGraph
label_desc: Use image node_id 3 for calling the TestSEMGraph obj's underlying member method code with example usage: obj.test_union_init() without return types