Skip to content

Commit de281d4

Browse files
committed
Add test for constraint kwargs
1 parent 0ce641f commit de281d4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pyomo/core/tests/unit/test_con.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,16 @@ def rule1(model):
16341634
except ValueError:
16351635
pass
16361636

1637+
def test_rule_kwargs(self):
1638+
m = ConcreteModel()
1639+
m.x = Var()
1640+
1641+
@m.Constraint(rhs=5)
1642+
def c(m, *, rhs):
1643+
return m.x <= rhs
1644+
1645+
self.assertExpressionsEqual(m.c.expr, m.x <= 5)
1646+
16371647
def test_tuple_constraint_create(self):
16381648
def rule1(model):
16391649
return (0.0, model.x)

0 commit comments

Comments
 (0)