Ejemplo n.º 1
0
    def test_valid_params_haz_only(self):
        """Both sets of parameters are valid for a hazard-only job config."""
        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_1)
        self.assertTrue(self.validator.is_valid()[0])

        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])
Ejemplo n.º 2
0
class ClassicalValidatorTestCase(unittest.TestCase):
    """Tests for :class:`openquake.job.config.ClassicalValidator`"""

    SECTIONS = ['HAZARD', 'RISK']

    # This is only bad for hazard+risk jobs; this perfectly valid
    # for a hazard-only job:
    PARAMS_1 = dict(COMPUTE_MEAN_HAZARD_CURVE='false')

    PARAMS_2 = dict(COMPUTE_MEAN_HAZARD_CURVE='true')

    def test_invalid_params_haz_plus_risk(self):
        """Test validation on a hazard+risk config with known-bad parameters.
        """
        self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_1)
        self.assertFalse(self.validator.is_valid()[0])

    def test_valid_params_haz_plus_risk(self):
        """Test validation on a hazard+risk config with known-good parameters.
        """
        self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])

    def test_valid_params_haz_only(self):
        """Both sets of parameters are valid for a hazard-only job config."""
        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_1)
        self.assertTrue(self.validator.is_valid()[0])

        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])
Ejemplo n.º 3
0
    def test_valid_params_haz_only(self):
        """Both sets of parameters are valid for a hazard-only job config."""
        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_1)
        self.assertTrue(self.validator.is_valid()[0])

        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])
Ejemplo n.º 4
0
class ClassicalValidatorTestCase(unittest.TestCase):
    """Tests for :class:`openquake.job.config.ClassicalValidator`"""

    SECTIONS = ['HAZARD', 'RISK']

    # This is only bad for hazard+risk jobs; this perfectly valid
    # for a hazard-only job:
    PARAMS_1 = dict(COMPUTE_MEAN_HAZARD_CURVE='false')

    PARAMS_2 = dict(COMPUTE_MEAN_HAZARD_CURVE='true')

    def test_invalid_params_haz_plus_risk(self):
        """Test validation on a hazard+risk config with known-bad parameters.
        """
        self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_1)
        self.assertFalse(self.validator.is_valid()[0])

    def test_valid_params_haz_plus_risk(self):
        """Test validation on a hazard+risk config with known-good parameters.
        """
        self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])

    def test_valid_params_haz_only(self):
        """Both sets of parameters are valid for a hazard-only job config."""
        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_1)
        self.assertTrue(self.validator.is_valid()[0])

        self.validator = ClassicalValidator(['HAZARD'], self.PARAMS_2)
        self.assertTrue(self.validator.is_valid()[0])
Ejemplo n.º 5
0
 def test_valid_params_haz_plus_risk(self):
     """Test validation on a hazard+risk config with known-good parameters.
     """
     self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_2)
     self.assertTrue(self.validator.is_valid()[0])
Ejemplo n.º 6
0
 def test_valid_params_haz_plus_risk(self):
     """Test validation on a hazard+risk config with known-good parameters.
     """
     self.validator = ClassicalValidator(self.SECTIONS, self.PARAMS_2)
     self.assertTrue(self.validator.is_valid()[0])