Example #1
0
 def add_CD(self):
     tt1 = ODM.TranslatedText(
         _content="Skip the BRTHMO field when BRTHYR length NE 4",
         lang="en")
     desc = ODM.Description()
     desc.TranslatedText = [tt1]
     cd = ODM.ConditionDef(OID="ODM.CD.BRTHMO",
                           Name="Skip BRTHMO when no BRTHYR")
     cd.Description = desc
     return [cd]
Example #2
0
 def test_to_xml(self):
     attrs = self.set_attributes()
     cd = ODM.ConditionDef(**attrs)
     cd.Description = ODM.Description()
     cd.Description.TranslatedText = [
         ODM.TranslatedText(
             _content="Skip the BRTHMO field when BRTHYR length NE 4",
             lang="en")
     ]
     cd.FormalExpression = [
         ODM.FormalExpression(Context="Python 3.7", _content="BRTHYR != 4")
     ]
     cd_xml = cd.to_xml()
     self.assertEqual(cd_xml.attrib["OID"], "ODM.CD.BRTHMO")
     fex_xml = cd_xml.find("FormalExpression")
     self.assertEqual(fex_xml.attrib["Context"], "Python 3.7")
Example #3
0
 def test_to_dict(self):
     attrs = self.set_attributes()
     cd = ODM.ConditionDef(**attrs)
     cd.Description = ODM.Description()
     cd.Description.TranslatedText = [
         ODM.TranslatedText(
             _content="Skip the BRTHMO field when BRTHYR length NE 4",
             lang="en")
     ]
     cd.FormalExpression = [
         ODM.FormalExpression(Context="Python 3.7", _content="BRTHYR != 4")
     ]
     cd_dict = cd.to_dict()
     print(cd_dict)
     self.assertEqual(cd_dict["OID"], "ODM.CD.BRTHMO")
     self.assertDictEqual(cd_dict, self.expected_dict())
Example #4
0
 def test_ConditionDef(self):
     attrs = {"OID": "ODM.CD.BRTHMO", "Name": "Skip BRTHMO when no BRTHYR"}
     cd = ODM.ConditionDef(**attrs)
     cd.Description = ODM.Description()
     cd.Description.TranslatedText = [
         ODM.TranslatedText(
             _content="Skip the BRTHMO field when BRTHYR length NE 4",
             lang="en")
     ]
     cd.FormalExpression = [
         ODM.FormalExpression(Context="Python 3.7", _content="BRTHYR != 4")
     ]
     cd_dict = cd.to_dict()
     print(cd_dict)
     is_valid = self.validator.verify_conformance(cd_dict, "ConditionDef")
     self.assertTrue(is_valid)
Example #5
0
 def setUp(self) -> None:
     attrs = self.set_attributes()
     self.cond_def = ODM.ConditionDef(**attrs)