def test_populate_person1(self): xml_string1 = "<WC><Person ID=\"PER_ELBARA\" Name=\"Mohamed ElBaradei\"><Crises><Crisis ID=\"CRI_UEGYPT\" /><Crisis ID=\"CRI_UEGYPT\" /><Crisis ID=\"CRI_UEGYPT\" /><Crisis ID=\"CRI_UEGYPT\" /></Crises><Organizations><Org ID=\"ORG_EGYGOV\" /><Org ID=\"ORG_EGYGOV\" /></Organizations><Kind>Politician</Kind><Location>Egypt</Location><Common></Common></Person></WC>" person_list1 = [] root1 = ET.fromstring(xml_string1) populate_person(root1, person_list1) self.assert_(len(person_list1) >= 1)
def test_populate_person2(self): xml_string = "<WC><Person ID=\"PER_MMORSI\" Name=\"Mohammed Morsi\"><Crises><Crisis ID=\"CRI_UEGYPT\" /></Crises><Organizations><Org ID=\"ORG_EGYGOV\" /><Org ID=\"ORG_MUSBRO\" /></Organizations><Kind>Politician</Kind><Location>Egypt</Location><Common></Common></Person></WC>" person_list = [] root = ET.fromstring(xml_string) populate_person(root, person_list) self.assert_(len(person_list) >= 1)
def test_export_person2(self): person_string = "<WC><Person ID=\"PER_MMORSI\" Name=\"Mohammed Morsi\"><Crises><Crisis ID=\"CRI_UEGYPT\" /></Crises><Organizations><Org ID=\"ORG_EGYGOV\" /><Org ID=\"ORG_MUSBRO\" /></Organizations><Kind>Politician</Kind><Location>Egypt</Location><Common></Common></Person></WC>" person_list = [] root = ET.fromstring(person_string) populate_person(root, person_list) person_xml = export_person(person_list[0]) check_string = person_string [4:-5] self.assertEqual(check_string, person_xml)