Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 committed May 8, 2024
1 parent 0fd3dd7 commit a9f8ae7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_hs015.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ def test_snopt_snstop(self):
# we should get 70/74
self.assert_inform_equal(sol, optInform=74)

def test_snopt_failed_initial(self):
def failed_fun(x_dict):
funcs = {"obj": 0.0, "con": [np.nan, np.nan]}
fail = True
return funcs, fail

self.optName = "SNOPT"
self.setup_optProb()
# swap obj to report NaN
self.optProb.objFun = failed_fun
sol = self.optimize(optOptions={}, storeHistory=True)
self.assert_inform_equal(sol, optInform=61)
# make sure empty history does not error out
hist = History(self.histFileName, flag="r")
hist.getValues()


if __name__ == "__main__":
unittest.main()

0 comments on commit a9f8ae7

Please sign in to comment.