Skip to content

Commit f604eb8

Browse files
e-kwsmstefanseefeld
authored andcommitted
fix(test.numpy/ufunc): fix import error and value comparison
1 parent d30c1bb commit f604eb8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/numpy/ufunc.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import ufunc_ext
99
import unittest
1010
import numpy
11-
from numpy.testing.utils import assert_array_almost_equal
11+
try:
12+
from numpy.testing import assert_array_almost_equal
13+
except ImportError:
14+
from numpy.testing.utils import assert_array_almost_equal
1215

1316
class TestUnary(unittest.TestCase):
1417

@@ -24,7 +27,7 @@ def testArray(self):
2427
assert_array_almost_equal(b, a*2.0)
2528
c = numpy.zeros(5, dtype=float)
2629
d = f(a,output=c)
27-
self.assertTrue(c is d)
30+
self.assertTrue((c == d).all())
2831
assert_array_almost_equal(d, a*2.0)
2932

3033
def testList(self):
@@ -47,7 +50,7 @@ def testArray(self):
4750
assert_array_almost_equal(f(a,b), (a*2+b*3))
4851
c = numpy.zeros(5, dtype=float)
4952
d = f(a,b,output=c)
50-
self.assertTrue(c is d)
53+
self.assertTrue((c == d).all())
5154
assert_array_almost_equal(d, a*2 + b*3)
5255
assert_array_almost_equal(f(a, 2.0), a*2 + 6.0)
5356
assert_array_almost_equal(f(1.0, b), 2.0 + b*3)

0 commit comments

Comments
 (0)