def test_gmpe_not_defined_for_region_type(self): """ Tests the case when source model contains a GMPE that is not defined in the GSIMS """ self.gsims = {'Active Shallow Crust': 'BooreAtkinson2008'} with self.assertRaises(ValueError) as ae: _ = haz._preprocess_gmpes(self.source_model, self.gsims) self.assertEqual(ae.exception.message, 'No GMPE defined for region type Subduction!')
def test_unsupported_gmpe(self): """ Tests the input with an unsupported GMPE """ self.gsims = {'Active Shallow Crust': 'BooreAtkinson2008', 'Subduction': 'Rubbish'} with self.assertRaises(ValueError) as ae: _ = haz._preprocess_gmpes(self.source_model, self.gsims) self.assertEqual(ae.exception.message, 'GMPE Rubbish not supported!')
def test_correct_input(self): """ Tests the input with supported GMPEs and regions """ self.gsims = {'Active Shallow Crust': 'BooreAtkinson2008', 'Subduction': 'AtkinsonBoore2003SInter'} gsim_output = haz._preprocess_gmpes(self.source_model, deepcopy(self.gsims)) self.assertTrue(isinstance(gsim_output['Active Shallow Crust'], gsim.boore_atkinson_2008.BooreAtkinson2008)) self.assertTrue(isinstance(gsim_output['Subduction'], gsim.atkinson_boore_2003.AtkinsonBoore2003SInter))
def test_unsupported_gmpe(self): """ Tests the input with an unsupported GMPE """ self.gsims = { 'Active Shallow Crust': 'BooreAtkinson2008', 'Subduction': 'Rubbish' } with self.assertRaises(ValueError) as ae: _ = haz._preprocess_gmpes(self.source_model, self.gsims) self.assertEqual(ae.exception.message, 'GMPE Rubbish not supported!')
def test_correct_input(self): """ Tests the input with supported GMPEs and regions """ self.gsims = { 'Active Shallow Crust': 'BooreAtkinson2008', 'Subduction': 'AtkinsonBoore2003SInter' } gsim_output = haz._preprocess_gmpes(self.source_model, deepcopy(self.gsims)) self.assertTrue( isinstance(gsim_output['Active Shallow Crust'], gsim.boore_atkinson_2008.BooreAtkinson2008)) self.assertTrue( isinstance(gsim_output['Subduction'], gsim.atkinson_boore_2003.AtkinsonBoore2003SInter))