Skip to content

Commit 590859d

Browse files
committed
Expect NotImplementedError for genexpr ** sqrt(2)
Update test to reflect that powering a generator expression by a non-constant expression should raise NotImplementedError. Replace the previous assertion that the operation succeeded and remove the TypeError case for sqrt("2"). Add a clarifying comment about only allowing power to constant expressions.
1 parent ad7370a commit 590859d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/test_expr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def test_genexpr_op_genexpr(model):
119119
assert isinstance(1/x**1.5 - genexpr, GenExpr)
120120
assert isinstance(y/x - exp(genexpr), GenExpr)
121121

122-
genexpr **= sqrt(2)
123-
assert isinstance(genexpr, GenExpr)
122+
# sqrt(2) is not a constant expression and
123+
# we can only power to constant expressions!
124+
with pytest.raises(NotImplementedError):
125+
genexpr **= sqrt(2)
124126

125-
with pytest.raises(TypeError):
126-
genexpr **= sqrt("2")
127127

128128
def test_degree(model):
129129
m, x, y, z = model

0 commit comments

Comments
 (0)