Skip to content

Commit

Permalink
A bit more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eytanadler committed Jun 21, 2024
1 parent 788ac14 commit 79ea720
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,17 @@ def test_masterFunc_fail_grad_after_fail_func(self):
fail flag for the gradient too.
"""
nDV = [4, 5]
self.setup_optProb(failFlag=(0, 1), nDV=nDV)
self.setup_optProb(failFlag=(0, 1000), nDV=nDV)

x = np.ones(np.sum(nDV), dtype=float) + 5

# Fail
_, _, fail = self.opt._masterFunc(x, ["gobj", "gcon"])
# Fail obj gradient on DVs that haven't been evaluated
_, fail = self.opt._masterFunc(x, ["gobj"])
self.assertTrue(fail)

# Fail con gradient on DVs that haven't been evaluated
x += 1
_, fail = self.opt._masterFunc(x, ["gcon"])
self.assertTrue(fail)

def test_masterFunc_succeed_grad_after_fail_func(self):
Expand Down

0 comments on commit 79ea720

Please sign in to comment.