def test_bad_columns_mock(): tmp_dir = scratch_path / "bad_columns_mock" dmf = DMF(path=tmp_dir, create=True) with AlamoMock() as mock: m = surrmod.SurrogateModel(Experiment(dmf)) with pytest.raises(KeyError): m.set_input_data(model_data, ["snork"], "cost")
def _test_run(tmp_dmf, model_data): sml = surrmod.SurrogateModel(Experiment(tmp_dmf)) sml.set_input_data(model_data, ['scoops'], 'cost') try: _ = sml.run() except errors.AlamoError: raise
def test_mock_alamo(): tmp_dir = scratch_path / "mock_alamo" dmf = DMF(path=tmp_dir, create=True) with AlamoMock() as mock: sml = surrmod.SurrogateModel(Experiment(dmf)) assert not mock.doalamo_called sml.set_input_data(model_data, ["scoops", "bowl"], "cost") sml.run() assert mock.doalamo_called # assert tuple(mock.xdata) == tuple(model_data["scoops"],model_data["bowl"]) assert tuple(mock.zdata) == tuple(model_data["cost"])
def _test_init(tmp_dmf): _ = surrmod.SurrogateModel(Experiment(tmp_dmf))
def test_bad_columns_mock(tmp_dmf, model_data): with AlamoMock() as mock: m = surrmod.SurrogateModel(Experiment(tmp_dmf)) with pytest.raises(KeyError): m.set_input_data(model_data, ['snork'], 'cost')
def test_run(): tmp_dir = scratch_path / "run" dmf = DMF(path=tmp_dir, create=True) sml = surrmod.SurrogateModel(Experiment(dmf)) sml.set_input_data(model_data, ["scoops", "bowl"], "cost") sml.run()
def test_init(): tmp_dir = scratch_path / "init" dmf = DMF(path=tmp_dir, create=True) surrmod.SurrogateModel(Experiment(dmf))