def test_getElement3(self): # test if cannot find a match row = fromstring("<crisisResourcePair>\ <crisisId>CRI_001</crisisId>\ <resourceId>RES_001</resourceId>\ </crisisResourcePair>") testElement = getElement(row, 'stateOrProvince') self.assert_(testElement == "NULL")
def test_getElement1(self): row = fromstring("<crisis>\ <crisisId>CRI_001</crisisId>\ <name>Katrina</name>\ <kind>Natural Disaster</kind>\ <streetAddress />\ <city>New Orleans</city>\ <stateOrProvince>Louisiana</stateOrProvince>\ <postalCode />\ <country>United States</country>\ <dateAndTime>2005-08-26T09:00:00</dateAndTime>\ <fatalities>1300</fatalities>\ <injuries>-1</injuries>\ <populationIll>-1</populationIll>\ <populationDisplaced />\ <environmentalImpact />\ <politicalChanges />\ <culturalChanges />\ <jobsLost>-1</jobsLost>\ <damageInUSD>10000000000</damageInUSD>\ <reparationCost>-1</reparationCost>\ <regulatoryChanges>-1</regulatoryChanges>\ </crisis>") testElement = getElement(row, 'crisisId') self.assert_(testElement == "CRI_001")
def test_getElement5(self): row = fromstring("<citationPair>\ <citationId>CIT_101</citationId>\ <citation>http://www.ncdc.noaa.gov/extremeevents/specialreports/Hurricane-Katrina.pdf</citation>\ </citationPair>") testElement = getElement(row, 'citation') self.assert_(testElement == "http://www.ncdc.noaa.gov/extremeevents/specialreports/Hurricane-Katrina.pdf")
def test_getElement6(self): row = fromstring("<url>\ <urlId>URL_101</urlId>\ <type>Image</type>\ <urlAddress>http://web.mit.edu/12.000/www/m2010/images/katrina-08-28-2005.jpg</urlAddress>\ </url>") testElement = getElement(row, 'stateOrProvince') self.assert_(testElement == "NULL")
def test_getElement5(self): row = fromstring("<citationPair>\ <citationId>CIT_101</citationId>\ <citation>http://www.ncdc.noaa.gov/extremeevents/specialreports/Hurricane-Katrina.pdf</citation>\ </citationPair>") testElement = getElement(row, 'citation') self.assert_( testElement == "http://www.ncdc.noaa.gov/extremeevents/specialreports/Hurricane-Katrina.pdf" )
def test_getElement4(self): row = fromstring("<person>\ <personId>PER_001</personId>\ <name>George Clooney</name>\ <kind>Actor / Actress </kind>\ <streetAddress>8817 Lookout Mountain Ave</streetAddress>\ <city>Los Angeles</city>\ <stateOrProvince>California</stateOrProvince>\ <postalCode>90046-1819</postalCode>\ <country>USA</country>\ </person>") testElement = getElement(row, 'stateOrProvince') self.assert_(testElement == "California")
def test_getElement2(self): #test case where returns 'NULL' row = fromstring("<org>\ <orgId>ORG_001</orgId>\ <name>FEMA</name>\ <kind>Government Agency</kind>\ <streetAddress>500 C Street SW</streetAddress>\ <city>Washington, D.C.</city>\ <stateOrProvince />\ <postalCode>20472</postalCode>\ <country>USA</country>\ <foundingMission>Support and protect citizens including during disaster or recovery</foundingMission>\ <dateFounded>1979-04-01</dateFounded>\ <dateAbolished>0001-01-01</dateAbolished>\ <majorEvents>First establishment of a federal emergency management in U.S. by Congressional Act of 1803</majorEvents>\ </org>") testElement = getElement(row, 'stateOrProvince') self.assert_(testElement == "NULL")