Skip to content

Commit 74e54ae

Browse files
committed
enh: add test for multiplication with constant with new dimension
1 parent df750a4 commit 74e54ae

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/test_linear_expression.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,14 @@ def test_linear_expression_with_constant(m, x, y):
246246

247247
def test_linear_expression_with_constant_multiplication(m, x, y):
248248
expr = x + 1
249-
expr = expr * 10
250-
assert isinstance(expr, LinearExpression)
251-
assert (expr.const == 10).all()
249+
250+
obs = expr * 10
251+
assert isinstance(obs, LinearExpression)
252+
assert (obs.const == 10).all()
253+
254+
obs = expr * pd.Series([1, 2, 3], index=pd.RangeIndex(3, name="new_dim"))
255+
assert isinstance(obs, LinearExpression)
256+
assert obs.shape == (2, 3, 1)
252257

253258

254259
def test_linear_expression_multi_indexed(u):

0 commit comments

Comments
 (0)