mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 04:22:16 +00:00
fix(test.numpy/ufunc): fix import error and value comparison
This commit is contained in:
committed by
Stefan Seefeld
parent
d30c1bb7a8
commit
f604eb8d0f
@@ -8,7 +8,10 @@
|
||||
import ufunc_ext
|
||||
import unittest
|
||||
import numpy
|
||||
from numpy.testing.utils import assert_array_almost_equal
|
||||
try:
|
||||
from numpy.testing import assert_array_almost_equal
|
||||
except ImportError:
|
||||
from numpy.testing.utils import assert_array_almost_equal
|
||||
|
||||
class TestUnary(unittest.TestCase):
|
||||
|
||||
@@ -24,7 +27,7 @@ class TestUnary(unittest.TestCase):
|
||||
assert_array_almost_equal(b, a*2.0)
|
||||
c = numpy.zeros(5, dtype=float)
|
||||
d = f(a,output=c)
|
||||
self.assertTrue(c is d)
|
||||
self.assertTrue((c == d).all())
|
||||
assert_array_almost_equal(d, a*2.0)
|
||||
|
||||
def testList(self):
|
||||
@@ -47,7 +50,7 @@ class TestBinary(unittest.TestCase):
|
||||
assert_array_almost_equal(f(a,b), (a*2+b*3))
|
||||
c = numpy.zeros(5, dtype=float)
|
||||
d = f(a,b,output=c)
|
||||
self.assertTrue(c is d)
|
||||
self.assertTrue((c == d).all())
|
||||
assert_array_almost_equal(d, a*2 + b*3)
|
||||
assert_array_almost_equal(f(a, 2.0), a*2 + 6.0)
|
||||
assert_array_almost_equal(f(1.0, b), 2.0 + b*3)
|
||||
|
||||
Reference in New Issue
Block a user