Skip to content

Commit 6c494d2

Browse files
committed
support Inf, NegInf, Nan in .has(...)
1 parent e839bc9 commit 6c494d2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

symengine/lib/symengine_wrapper.in.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4950,7 +4950,7 @@ def powermod_list(a, b, m):
49504950
def has_symbol(obj, symbol=None):
49514951
cdef Basic b = _sympify(obj)
49524952
cdef Basic s = _sympify(symbol)
4953-
require(s, (Symbol, FunctionSymbol))
4953+
require(s, (Symbol, FunctionSymbol, Infinity, NegativeInfinity, NaN))
49544954
if (not symbol):
49554955
return not b.free_symbols.empty()
49564956
else:

symengine/tests/test_expr.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ def test_as_powers_dict():
2626
assert (x*(1/Integer(2))**y).as_powers_dict() == {x: Integer(1), Integer(2): -y}
2727
assert (2**y).as_powers_dict() == {2: y}
2828
assert (2**-y).as_powers_dict() == {2: -y}
29+
30+
31+
def test_has():
32+
x = Symbol('x')
33+
assert (x + oo).has(oo)
34+
assert (x - oo).has(-oo)
35+
assert not (x + oo).has(-oo)
36+
#assert not (x - oo).has(oo) <-- not sure we want to test explicitly for "x + NegativeInfinity"

0 commit comments

Comments
 (0)