Ejemplo n.º 1
0
    def test_merge_3 (self) :
        					
        


        
        myBirthdate = Date(time = None,
        				   day = 0,
        				   month = 0,
        				   year = 0,
        				   misc = None)
        myBirthdate.put()
        				   
                           
        
        myInfo = PersonInfo(type_ = None,
                            birthdate = myBirthdate,
          					nationality = None,
                            biography = None
                            )
        myInfo.put()
        
        myLink = Link(site = None,
                     title = None,
                     url = "https://www.google.com",
                     description = None)
        myLink.put()
        

        myReference = Reference(primaryimage = myLink.key())
        myReference.images.append(myLink.key())
        myReference.videos.append(myLink.key())
        myReference.socials.append(myLink.key())
        myReference.exts.append(myLink.key())
        
        myReference.put()
        
        
        entity = Person(key_name = "Mir_Hossein_Mousavi", 
                        idref = "Mir_Hossein_Mousavi", 
                        name = "Mir Hossein Mousavi",
                        info = myInfo,
                        ref = myReference, #TODO
                        misc = None,
                        relatedCrises = [],
                        relatedOrgs = []
                        )
                        
        
                      
        
        
        tree = ET.ElementTree(file = open("WC2.xml", "r"))
        root = tree.getroot()
        people = root.findall("person")
        for person in people: 
            if person.find("name").text == "Mir Hossein Mousavi":
                 merge(entity, person)
        self.assert_(entity.info.nationality == "Iran")
Ejemplo n.º 2
0
 def test_merge_1 (self) :
     
     myTime = Date(time = None,
                   day = 0,
                   month = 0,
                   year = 0, 
                   misc = None)
     myTime.put()
     
     myLoc = Location(city = None,
                         region = None,
                         country = None,
                         missing = None) 
     myLoc.put()
                         
     myHuman = HumanImpact(deaths = 0,
                         displaced = 0,
                         injured = 0,
                         missing = 0, 
                         misc = None)
     myHuman.put()
                         
     myEconomic = EconomicImpact(amount = 0,
                                 currency = None,
                                 misc = None)
     myEconomic.put()
     
     myImpact = Impact(human = myHuman,
                       economic = myEconomic)
     myImpact.put()
     
     myInfo = CrisisInfo(history = None,
                         help = None,
                         resources = None,
                         type_ = None, 
                         time = myTime,
                         loc = myLoc,
                         impact = myImpact
                         )
     myInfo.put()
     
     myLink = Link(site = None,
                  title = None,
                  url = "https://www.google.com", #TODO
                  description = None)
     myLink.put()
     
     myReference = Reference(primaryimage = myLink.key())
     myReference.images.append(myLink.key())
     myReference.videos.append(myLink.key())
     myReference.socials.append(myLink.key())
     myReference.exts.append(myLink.key())
     
     myReference.put()
     
     
     entity = Crisis(key_name = "Libyan_Civil_War", 
                     idref = "Libyan_Civil_War", 
                     name = "Libyan Civil War",
                     info = myInfo,
                     ref = myReference,
                     misc = None,
                     relatedOrgs = [],
                     relatedPeople = []
                     )
     
     tree = ET.ElementTree(file = open("WC2.xml", "r"))
     root = tree.getroot()
     crises = root.findall("crisis")
     for crisis in crises: 
         if crisis.find("name").text == "Libyan Civil War":
              merge(entity, crisis)
     self.assert_(entity.info.time.year == 2011)