Skip to content

Commit 65ceced

Browse files
committed
Skip tests if numpy is not installed
1 parent 97ded08 commit 65ceced

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

symengine/tests/test_subs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import numpy as np
1+
import unittest
22

33
from symengine.utilities import raises
4-
from symengine import Symbol, sin, cos, sqrt, Add, function_symbol
4+
from symengine import Symbol, sin, cos, sqrt, Add, function_symbol, have_numpy
55

66

77
def test_basic():
@@ -60,13 +60,17 @@ def test_xreplace():
6060
assert f.xreplace({x: y}) == sin(cos(y))
6161

6262

63+
@unittest.skipUnless(have_numpy, "Numpy not installed")
6364
def test_float32():
65+
import numpy as np
6466
x = Symbol("x")
6567
expr = x * 2
6668
assert expr.subs({x: np.float32(2)}) == 4.0
6769

6870

71+
@unittest.skipUnless(have_numpy, "Numpy not installed")
6972
def test_float16():
73+
import numpy as np
7074
x = Symbol("x")
7175
expr = x * 2
7276
assert expr.subs({x: np.float16(2)}) == 4.0

0 commit comments

Comments
 (0)