Skip to content

Commit

Permalink
fix: updated test cases for new logging scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
becktepe committed Oct 8, 2024
1 parent f6bd740 commit 4cfcf15
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/test_maximize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand All @@ -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")

0 comments on commit 4cfcf15

Please sign in to comment.