Skip to content

Commit 174ec99

Browse files
author
Robbie Muir
committed
added test
1 parent 345dcef commit 174ec99

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test_objective.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ def quadratic_objective() -> Objective:
2626
return m.objective
2727

2828

29+
def test_set_objective_from_variable() -> None:
30+
m = Model()
31+
v = m.add_variables(coords=[[1, 2, 3]])
32+
m.add_objective(v)
33+
assert isinstance(m.objective, Objective)
34+
assert isinstance(m.objective.expression, LinearExpression)
35+
36+
2937
def test_model(linear_objective: Objective, quadratic_objective: Objective) -> None:
3038
assert isinstance(linear_objective.model, Model)
3139
assert isinstance(quadratic_objective.model, Model)

0 commit comments

Comments
 (0)