Exemplo n.º 1
0
 def test_obsolete_mode(self):
     haz_job = FakeJob('hazard', 'scenario')
     with self.assertRaises(ValueError) as ctx:
         engine.check_hazard_risk_consistency(
             haz_job, 'scenario')
     msg = str(ctx.exception)
     self.assertEqual(msg, 'Please change calculation_mode=scenario into '
                      'scenario_risk in the .ini file')
Exemplo n.º 2
0
 def test_obsolete_mode(self):
     haz_job = FakeJob('hazard', 'scenario')
     with self.assertRaises(ValueError) as ctx:
         engine.check_hazard_risk_consistency(haz_job, 'scenario')
     msg = str(ctx.exception)
     self.assertEqual(
         msg, 'Please change calculation_mode=scenario into '
         'scenario_risk in the .ini file')
Exemplo n.º 3
0
 def test_inconsistent_mode(self):
     haz_job = FakeJob('hazard', 'scenario')
     with self.assertRaises(engine.InvalidHazardCalculationID) as ctx:
         engine.check_hazard_risk_consistency(haz_job, 'classical_risk')
     msg = str(ctx.exception)
     self.assertEqual(
         msg, "In order to run a risk calculation of kind "
         "'classical_risk', you need to provide a hazard "
         "calculation of kind ['classical'], "
         "but you provided a 'scenario' instead")
Exemplo n.º 4
0
 def test_inconsistent_mode(self):
     haz_job = FakeJob('hazard', 'scenario')
     with self.assertRaises(engine.InvalidHazardCalculationID) as ctx:
         engine.check_hazard_risk_consistency(
             haz_job, 'classical_risk')
     msg = str(ctx.exception)
     self.assertEqual(
         msg, "In order to run a risk calculation of kind "
         "'classical_risk', you need to provide a hazard "
         "calculation of kind ['classical'], "
         "but you provided a 'scenario' instead")
Exemplo n.º 5
0
 def test_no_hazard(self):
     haz_job = FakeJob('risk', 'scenario')
     with self.assertRaises(engine.InvalidHazardCalculationID):
         engine.check_hazard_risk_consistency(haz_job, 'scenario_risk')
Exemplo n.º 6
0
 def test_ok(self):
     haz_job = FakeJob('hazard', 'scenario')
     engine.check_hazard_risk_consistency(haz_job, 'scenario_risk')
Exemplo n.º 7
0
 def test_no_hazard(self):
     haz_job = FakeJob('risk', 'scenario')
     with self.assertRaises(engine.InvalidHazardCalculationID):
         engine.check_hazard_risk_consistency(
             haz_job, 'scenario_risk')
Exemplo n.º 8
0
 def test_ok(self):
     haz_job = FakeJob('hazard', 'scenario')
     engine.check_hazard_risk_consistency(
         haz_job, 'scenario_risk')