Skip to content

Commit

Permalink
Add fail test for when pathfinder can't optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Nov 14, 2024
1 parent 53a5a69 commit db62fd9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clients/python/tests/test_pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ def test_inits(multimodal_model, temp_json):
assert np.all(out3["mu"] < 0)


def test_inits_mode(multimodal_model):
# initializing at mode means theres nowhere to go
init1 = {"mu": -100}

with pytest.raises(
RuntimeError, match="None of the LBFGS iterations completed successfully"
):
multimodal_model.pathfinder(inits=init1)

# also for single path
with pytest.raises(
RuntimeError, match="None of the LBFGS iterations completed successfully"
):
multimodal_model.pathfinder(inits=init1, num_paths=1, psis_resample=False)


def test_bad_data(bernoulli_model):
data = {"N": -1}
with pytest.raises(RuntimeError, match="greater than or equal to 0"):
Expand Down

0 comments on commit db62fd9

Please sign in to comment.