code: def test_serialize_predicate(self):
      # arrange
      srz = serializer.NyokaSerializer()
      model = models.SimplePMMLRuleSetModel(
          dataDictionary=models.DataDictionary(dataFields=None),  # noqa
          ruleSetModel=models.RuleSetModel(
              miningSchema=None,  # noqa
              ruleSet=models.RuleSet(
                  ruleSelectionMethod=None,  # noqa
                  rules=[
                      models.SimpleRule(
                          score="test1",
                          predicate=models.SimplePredicate(
                              field="toto1",
                              operator=models.Operator.greaterOrEqual,
                              value="128",
                          ),
                      ),
                      models.SimpleRule(
                          score="test2",
                          predicate=models.CompoundPredicate(
                              booleanOperator=models.BooleanOperator.and_,
                              simplePredicates=[
                                  models.SimplePredicate(
                                      field="toto2",
                                      operator=models.Operator.lessThan,
                                      value="20.5",
                                  ),
                                  models.SimplePredicate(
                                      field="toto2",
                                      operator=models.Operator.equal,
                                      value="good",
                                  ),
                              ],
                          ),
                          id="test-id",
                          recordCount=5,
                          nbCorrect=3,
                          confidence=0.86,
                          weight=0.6,
                      ),
                  ],
              ),
          ),
      )
  
      # when
      serialized = srz.serialize(model)
      res_data_dictionary_dict = xmltodict.parse(xml_input=serialized)[
          "PMML"
      ]["RuleSetModel"]["RuleSet"]
  
      # assert
      expected = """
              <RuleSet>
                  <SimpleRule score="test1">
                      <SimplePredicate field="toto1" operator="greaterOrEqual" value="128"/>
                  </SimpleRule>
                  <SimpleRule id="test-id" score="test2" recordCount="5" nbCorrect="3" confidence="0.86" weight="0.6">
                      <CompoundPredicate booleanOperator="and">
                          <SimplePredicate field="toto2" operator="lessThan" value="20.5"/>
                          <SimplePredicate field="toto2" operator="equal" value="good"/>
                      </CompoundPredicate>
                  </SimpleRule>
              </RuleSet>
              """
      self.assertEqual(
          res_data_dictionary_dict,
          xmltodict.parse(xml_input=expected)["RuleSet"],
      )
  
imports: from unittest import TestCase
  import xmltodict
  import aix360.algorithms.rule_induction.trxf.pmml_export.models
  import aix360.algorithms.rule_induction.trxf.pmml_export.serializer
label_desc: Use image node_id 2 for calling the TestNyokaSerializer obj's underlying member method code with example usage: obj.test_serialize_predicate() without return types