code: def test_factor_reduce_statename(self):
      phi = DiscreteFactor(
          ["speed", "switch", "time"],
          [3, 2, 2],
          np.ones(12),
          state_names=self.sn1,
      )
      phi.reduce([("speed", "medium"), ("time", "day")])
      self.assertEqual(phi.variables, ["switch"])
      self.assertEqual(phi.cardinality, [2])
      np_test.assert_array_equal(phi.values, np.array([1, 1]))
  
      phi = DiscreteFactor(
          ["speed", "switch", "time"],
          [3, 2, 2],
          np.ones(12),
          state_names=self.sn1,
      )
      phi = phi.reduce(
          [("speed", "medium"), ("time", "day")], inplace=False
      )
      self.assertEqual(phi.variables, ["switch"])
      self.assertEqual(phi.cardinality, [2])
      np_test.assert_array_equal(phi.values, np.array([1, 1]))
  
      phi = DiscreteFactor(
          ["speed", "switch", "time"], [3, 2, 2], np.ones(12)
      )
      phi.reduce([("speed", 1), ("time", 0)])
      self.assertEqual(phi.variables, ["switch"])
      self.assertEqual(phi.cardinality, [2])
      np_test.assert_array_equal(phi.values, np.array([1, 1]))
  
      phi = DiscreteFactor(
          ["speed", "switch", "time"], [3, 2, 2], np.ones(12)
      )
      phi = phi.reduce([("speed", 1), ("time", 0)], inplace=False)
      self.assertEqual(phi.variables, ["switch"])
      self.assertEqual(phi.cardinality, [2])
      np_test.assert_array_equal(phi.values, np.array([1, 1]))
  
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 3 for calling the StateNameDecorator obj's underlying member method code with example usage: obj.test_factor_reduce_statename() without return types