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)
def test_is_subset_invalid(input_list, list_length): example_list = ["a", "b", "c"] assert len(validator.is_subset(example_list, input_list)) == list_length
def test_is_subset_valid(input_list, result_list): example_list = ["a", "b", "c"] assert validator.is_subset(example_list, input_list) == result_list