diff --git a/tests/test_maximize.py b/tests/test_maximize.py index 7618167..3b84cc1 100644 --- a/tests/test_maximize.py +++ b/tests/test_maximize.py @@ -15,12 +15,12 @@ def test_non_max_incumbent(): subprocess.call(["python", "examples/branin.py", "--config-name=branin_rs", "-m"]) assert Path("./tmp/branin_rs").exists(), "Run directory not created" runhistory = pd.read_csv("./tmp/branin_rs/runhistory.csv") - with open(Path("./tmp/branin_rs/incumbent.json")) as f: - last_line = f.readlines()[-1] - incumbent = json.loads(last_line) - assert np.round(incumbent["score"], decimals=3) == np.round( + incumbent = pd.read_csv("./tmp/branin_rs/incumbent.csv") + incumbent = incumbent.iloc[-1] + + assert np.round(incumbent["performance"], decimals=3) == np.round( runhistory["performance"].min(), decimals=3 - ), "Incumbent is not the minimum score in the runhistory" + ), "Incumbent is not the minimum performance in the runhistory" shutil.rmtree("./tmp") @@ -30,12 +30,12 @@ def test_max_incumbent(): ) assert Path("./tmp/branin_rs").exists(), "Run directory not created" runhistory = pd.read_csv("./tmp/branin_rs/runhistory.csv") - with open(Path("./tmp/branin_rs/incumbent.json")) as f: - last_line = f.readlines()[-1] - incumbent = json.loads(last_line) - print(incumbent["score"], runhistory["performance"].max(), runhistory.performance.min()) + incumbent = pd.read_csv("./tmp/branin_rs/incumbent.csv") + incumbent = incumbent.iloc[-1] + + print(incumbent["performance"], runhistory["performance"].max(), runhistory.performance.min()) print(runhistory.values) - assert np.round(incumbent["score"], decimals=3) == np.round( + assert np.round(incumbent["performance"], decimals=3) == np.round( runhistory["performance"].max(), decimals=3 ), "Incumbent is not the maximum score in the runhistory even though maximize is enabled" shutil.rmtree("./tmp")