Skip to content

Commit

Permalink
adding a test that fails without enabling multiple attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
William Zijie Zhang committed Feb 2, 2025
1 parent a496292 commit c2e84bb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cvxpy/tests/test_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,12 @@ def test_integer_bounds(self) -> None:
assert type(new_prob.apply(prob)[0].constraints[1]) is Inequality
assert type(new_prob.apply(prob)[0].constraints[2]) is Equality

prob.solve()
assert np.allclose(x.value, target)

def test_nonpos_nonneg_variable(self) -> None:
x = cp.Variable(shape=(2,2), nonpos=True, nonneg=True)
target = np.zeros((2,2))
prob = cp.Problem(cp.Minimize(cp.sum(x)), [x >= -5])
prob.solve()
assert np.allclose(x.value, target)

0 comments on commit c2e84bb

Please sign in to comment.