Skip to content

Commit a68f7fc

Browse files
rikardnisuruf
andcommitted
Export singleton sets from S
Co-authored-by: Isuru Fernando <[email protected]>
1 parent d6fc03d commit a68f7fc

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

symengine/__init__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import symengine.lib.symengine_wrapper as wrapper
2+
13
from .lib.symengine_wrapper import (
24
have_mpfr, have_mpc, have_flint, have_piranha, have_llvm, have_llvm_long_double,
35
I, E, pi, oo, zoo, nan, Symbol, Dummy, S, sympify, SympifyError,
@@ -12,7 +14,7 @@
1214
LessThan, StrictGreaterThan, StrictLessThan, Eq, Ne, Ge, Le,
1315
Gt, Lt, And, Or, Not, Nand, Nor, Xor, Xnor, perfect_power, integer_nthroot,
1416
isprime, sqrt_mod, Expr, cse, count_ops, ccode, Piecewise, Contains, Interval, FiniteSet,
15-
EmptySet, UniversalSet, Reals, Integers, linsolve,
17+
linsolve,
1618
FunctionSymbol as AppliedUndef,
1719
golden_ratio as GoldenRatio,
1820
catalan as Catalan,
@@ -22,6 +24,13 @@
2224
from .functions import *
2325
from .printing import init_printing
2426

27+
28+
EmptySet = wrapper.S.EmptySet
29+
UniversalSet = wrapper.S.UniversalSet
30+
Reals = wrapper.S.Reals
31+
Integers = wrapper.S.Integers
32+
33+
2534
if have_mpfr:
2635
from .lib.symengine_wrapper import RealMPFR
2736

@@ -38,6 +47,12 @@ def lambdify(args, exprs, **kwargs):
3847
__version__ = "0.6.1"
3948

4049

50+
# To not expose internals
51+
del lib.symengine_wrapper
52+
del lib
53+
del wrapper
54+
55+
4156
def test():
4257
import pytest
4358
import os

symengine/tests/test_solve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def test_solve():
77
x = Symbol("x")
88
reals = Interval(-oo, oo)
99

10-
assert solve(1, x, reals) == EmptySet()
10+
assert solve(1, x, reals) == EmptySet
1111
assert solve(0, x, reals) == reals
1212
assert solve(x + 3, x, reals) == FiniteSet(-3)
13-
assert solve(x + 3, x, Interval(0, oo)) == EmptySet()
13+
assert solve(x + 3, x, Interval(0, oo)) == EmptySet
1414
assert solve(x, x, reals) == FiniteSet(0)
1515
assert solve(x**2 + 1, x) == FiniteSet(-I, I)
1616
assert solve(x**2 - 2*x + 1, x) == FiniteSet(1)

0 commit comments

Comments
 (0)