def test_valid_option(self): """Validation: test that a string is a valid option.""" from natcap.invest import validation self.assertEqual( None, validation.check_option_string('foo', options=['foo', 'bar', 'Baz']))
def test_invalid_option(self): """Validation: test when a string is not a valid option.""" from natcap.invest import validation error_msg = validation.check_option_string( 'FOO', options=['foo', 'bar', 'Baz']) self.assertTrue('must be one of' in error_msg)