From 8244c4d3aa8cf5d31aae320232599f1293d2a081 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 20 Apr 2019 02:26:43 -0500 Subject: [PATCH] Make constants return true for is_number --- symengine/lib/symengine_wrapper.pyx | 4 ++++ symengine/tests/test_number.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/symengine/lib/symengine_wrapper.pyx b/symengine/lib/symengine_wrapper.pyx index 0d1bbfcc1..ea8d301dc 100644 --- a/symengine/lib/symengine_wrapper.pyx +++ b/symengine/lib/symengine_wrapper.pyx @@ -1230,6 +1230,10 @@ cdef class Constant(Expr): return self.thisptr = symengine.make_rcp_Constant(name.encode("utf-8")) + @property + def is_number(self): + return True + def _sympy_(self): raise Exception("Unknown Constant") diff --git a/symengine/tests/test_number.py b/symengine/tests/test_number.py index a189027c2..405bf0fb9 100644 --- a/symengine/tests/test_number.py +++ b/symengine/tests/test_number.py @@ -1,6 +1,6 @@ from symengine.utilities import raises -from symengine import Integer, I, S +from symengine import Integer, I, S, pi from symengine.lib.symengine_wrapper import (perfect_power, is_square, integer_nthroot) @@ -94,6 +94,8 @@ def test_is_conditions(): assert not i.is_nonnegative assert i.is_complex + assert pi.is_number + def test_perfect_power(): assert perfect_power(1) == True