Example #1
0
 def _validate(self):
     """
     Validates the job. If invalid, raises an ValidationError.
     """
     errors = [] if self._config.valid else list(self._config.errors)
     calc_keys = self.get_calc_keys()
     application_keys = [
         entry.key for entry in self._config.snapshot.UPDATE_KEYS.keys
     ]
     errors.extend(is_subset(calc_keys, application_keys))
     errors.extend(
         has_keys(self._obs_keys, calc_keys, "Key: {} has no observations"))
     errors.extend(
         has_keys(self._obs_with_data, calc_keys, "Key: {} has no data"))
     if len(errors) > 0:
         raise ValidationError("Invalid job", errors)
Example #2
0
def test_has_keys(test_input, expected_result):
    obs = ["POLY_OBS"]
    msg = "fail_message"
    assert len(validator.has_keys(obs, test_input, msg)) == expected_result