Skip to content

Commit

Permalink
MAINT: test types and rename test function
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Dec 18, 2023
1 parent 53f8a64 commit de260fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/sympy/test_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def evaluate(self) -> sp.Expr:
assert y_expr.doit() == 5**3


def test_unevaluated_expression_classvar_symbol():
def test_unevaluated_expression_default_argument():
@unevaluated_expression
class FunkyPower(sp.Expr):
x: Any
Expand All @@ -155,12 +155,20 @@ def evaluate(self) -> sp.Expr:
assert exprs[0].doit() == x
assert exprs[1].doit() == x**2
assert exprs[2].doit() == x**3
for expr in exprs:
assert expr.x is x
assert isinstance(expr.m, sp.Integer)
assert expr.default_return is None

half = sp.Rational(1, 2)
FunkyPower.default_return = half
assert exprs[0].doit() == half
assert exprs[1].doit() == half
assert exprs[2].doit() == half
for expr in exprs:
assert expr.x is x
assert isinstance(expr.m, sp.Integer)
assert expr.default_return is half


def test_unevaluated_expression_callable():
Expand Down

0 comments on commit de260fb

Please sign in to comment.