Updating tests for CP regression to use validation.

RE:#BITBUCKET-3610  RE:#BITBUCKET-3597
This commit is contained in:
James Douglass 2017-06-27 15:58:20 -07:00
parent 8df6813294
commit ac5d100eb8
2 changed files with 3 additions and 8 deletions

View File

@ -118,10 +118,6 @@ def execute(args):
Returns:
None.
"""
warnings_ = validate(args)
if warnings_:
raise ValueError(str(warnings_))
crop_to_landcover_table = utils.build_lookup_from_csv(
args['landcover_to_crop_table_path'], 'crop_name', to_lower=True,
numerical_cast=True)
@ -132,7 +128,6 @@ def execute(args):
args['model_data_path'],
_EXTENDED_CLIMATE_BIN_FILE_PATTERN % crop_name)
file_suffix = utils.make_suffix_string(args, 'results_suffix')
output_dir = os.path.join(args['workspace_dir'])
utils.make_directories([

View File

@ -83,12 +83,12 @@ class CropProductionTests(unittest.TestCase):
landcover_crop_table.write(
'crop_name,lucode\nfakecrop,20\n')
with self.assertRaises(ValueError):
crop_production_percentile.execute(args)
errors = crop_production_percentile.validate(args)
self.assertEqual(len(errors), 1)
@scm.skip_if_data_missing(SAMPLE_DATA_PATH)
@scm.skip_if_data_missing(MODEL_DATA_PATH)
def test_crop_production_percentile_bad_crop(self):
def test_crop_production_regression_bad_crop(self):
"""Crop Production: test crop regression with a bad crop name."""
from natcap.invest import crop_production_regression