code: def test_reduce_cpd_statename(self):
      cpd = TabularCPD(
          "grade",
          3,
          [
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.8, 0.8, 0.8, 0.8, 0.8, 0.8],
          ],
          evidence=["diff", "intel"],
          evidence_card=[2, 3],
          state_names=self.sn2,
      )
      cpd.reduce([("diff", "high")])
      self.assertEqual(cpd.variable, "grade")
      self.assertEqual(cpd.variables, ["grade", "intel"])
      np_test.assert_array_equal(
          cpd.get_values(),
          np.array([[0.1, 0.1, 0.1], [0.1, 0.1, 0.1], [0.8, 0.8, 0.8]]),
      )
  
      cpd = TabularCPD(
          "grade",
          3,
          [
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.8, 0.8, 0.8, 0.8, 0.8, 0.8],
          ],
          evidence=["diff", "intel"],
          evidence_card=[2, 3],
      )
      cpd.reduce([("diff", 0)])
      self.assertEqual(cpd.variable, "grade")
      self.assertEqual(cpd.variables, ["grade", "intel"])
      np_test.assert_array_equal(
          cpd.get_values(),
          np.array([[0.1, 0.1, 0.1], [0.1, 0.1, 0.1], [0.8, 0.8, 0.8]]),
      )
  
      cpd = TabularCPD(
          "grade",
          3,
          [
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.8, 0.8, 0.8, 0.8, 0.8, 0.8],
          ],
          evidence=["diff", "intel"],
          evidence_card=[2, 3],
          state_names=self.sn2,
      )
      cpd = cpd.reduce([("diff", "high")], inplace=False)
      self.assertEqual(cpd.variable, "grade")
      self.assertEqual(cpd.variables, ["grade", "intel"])
      np_test.assert_array_equal(
          cpd.get_values(),
          np.array([[0.1, 0.1, 0.1], [0.1, 0.1, 0.1], [0.8, 0.8, 0.8]]),
      )
  
      cpd = TabularCPD(
          "grade",
          3,
          [
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
              [0.8, 0.8, 0.8, 0.8, 0.8, 0.8],
          ],
          evidence=["diff", "intel"],
          evidence_card=[2, 3],
      )
      cpd = cpd.reduce([("diff", 0)], inplace=False)
      self.assertEqual(cpd.variable, "grade")
      self.assertEqual(cpd.variables, ["grade", "intel"])
      np_test.assert_array_equal(
          cpd.get_values(),
          np.array([[0.1, 0.1, 0.1], [0.1, 0.1, 0.1], [0.8, 0.8, 0.8]]),
      )
  
file_path: pgmpy/pgmpy/tests/test_utils/test_state_name.py
imports: import unittest
  import numpy
  import numpy.testing
  from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
  from pgmpy.models import BayesianNetwork
  from pgmpy.inference import Inference
  from pgmpy.inference import VariableElimination
label_desc: Use image node_id 4 for calling the StateNameDecorator obj's underlying member method code with example usage: obj.test_reduce_cpd_statename() without return types