def test_raise_out_of_bounds_error(self):
    model = om.Group()
    ivc = om.IndepVarComp()
    mapdata = SampleMap()
    params = mapdata.param_data
    (x, y, z) = params
    outs = mapdata.output_data
    z = outs[0]
    ivc.add_output('x', x['default'], units=x['units'])
    ivc.add_output('y', y['default'], units=y['units'])
    ivc.add_output('z', z['default'], units=z['units'])
    model.add_subsystem('des_vars', ivc, promotes=['*'])
    comp = om.MetaModelStructuredComp(method='scipy_slinear', extrapolate=False)
    for param in params:
        comp.add_input(param['name'], param['default'], param['values'])
    for out in outs:
        comp.add_output(out['name'], out['default'], out['values'])
    model.add_subsystem('comp', comp, promotes=['*'])
    self.prob = om.Problem(model)
    self.prob.setup()
    self.prob['x'] = 1.0
    self.prob['y'] = 0.75
    self.prob['z'] = 9.0
    msg = "'comp' <class MetaModelStructuredComp>: Error interpolating output '[f|g]' because input 'comp.z' was out of bounds \\('.*', '.*'\\) with value '9.0'"
    with self.assertRaisesRegex(om.AnalysisError, msg):
        self.run_and_check_derivs(self.prob)
def test_raise_out_of_bounds_error(self):
    model = om.Group()
    ivc = om.IndepVarComp()
    mapdata = SampleMap()
    params = mapdata.param_data
    (x, y, z) = params
    outs = mapdata.output_data
    z = outs[0]
    ivc.add_output('x', x['default'], units=x['units'])
    ivc.add_output('y', y['default'], units=y['units'])
    ivc.add_output('z', z['default'], units=z['units'])
    model.add_subsystem('des_vars', ivc, promotes=['*'])
    comp = om.MetaModelStructuredComp(method='scipy_slinear', extrapolate=False)
    for param in params:
        comp.add_input(param['name'], param['default'], param['values'])
    for out in outs:
        comp.add_output(out['name'], out['default'], out['values'])
    model.add_subsystem('comp', comp, promotes=['*'])
    self.prob = om.Problem(model)
    self.prob.setup()
    self.prob['x'] = 1.0
    self.prob['y'] = 0.75
    self.prob['z'] = 9.0
    msg = "'comp' <class MetaModelStructuredComp>: Error interpolating output '[f|g]' because input 'comp.z' was out of bounds \\('.*', '.*'\\) with value '9.0'"
    with self.assertRaisesRegex(om.AnalysisError, msg):
        self.run_and_check_derivs(self.prob)