Skip to content

Commit 7cdba28

Browse files
committed
Add test for Lambdify of Piecewise using LLVM
1 parent 5ed8c0b commit 7cdba28

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

symengine/tests/test_lambdify.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,22 @@ def test_Lambdify():
7676
[3*n+3, n**2, -1/(n+2), n*(n+1)*(n+2)])
7777

7878

79-
@unittest.skipUnless(have_numpy, "Numpy not installed")
80-
def test_Lambdify_Piecewise():
79+
def _test_Lambdify_Piecewise(Lambdify):
8180
x = se.symbols('x')
8281
p = se.Piecewise((-x, x<0), (x*x*x, True))
83-
f = se.Lambdify([x], [p])
82+
f = Lambdify([x], [p])
8483
arr = np.linspace(3, 7)
8584
assert np.allclose(f(-arr).flat, arr, atol=1e-14, rtol=1e-15)
8685
assert np.allclose(f(arr).flat, arr**3, atol=1e-14, rtol=1e-15)
8786

8887

88+
@unittest.skipUnless(have_numpy, "Numpy not installed")
89+
def test_Lambdify_Piecewise():
90+
_test_Lambdify_Piecewise(lambda *args: se.Lambdify(*args, backend='lambda'))
91+
if se.have_llvm:
92+
_test_Lambdify_Piecewise(lambda *args: se.Lambdify(*args, backend='llvm'))
93+
94+
8995
@unittest.skipUnless(have_numpy, "Numpy not installed")
9096
def test_Lambdify_LLVM():
9197
n = 7

symengine_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9b604b2757aa09ae9d2286510eaf4b75d9b2b796
1+
df99e0c98cd3358cae69d3c422641761d7e9aacc

0 commit comments

Comments
 (0)